__checked_selected_helper() – Private helper function for checked, selected, disabled and readonly.

You appear to be a bot. Output may be restricted

Description

Private helper function for checked, selected, disabled and readonly.

Compares the first two arguments and if identical marks as `$type`.

Usage

$string = __checked_selected_helper( $helper, $current, $display, $type );

Parameters

$helper
( mixed ) required – One of the values to compare.
$current
( mixed ) required – The other value to compare if not just true.
$display
( bool ) required – Whether to echo or just return the string.
$type
( string ) required – The type of checked|selected|disabled|readonly we are doing.

Returns

string HTML attribute or empty string.

Source

File name: wordpress/wp-includes/general-template.php


Lines:

1 to 14 of 14
function __checked_selected_helper( $helper, $current, $display, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
  if ( (string) $helper === (string) $current ) {
    $result = " $type='$type'";
  } else {
    $result = '';
  }

  if ( $display ) {
    echo $result;
  }

  return $result;
}
 

 View on GitHub View on Trac