Description
Compares the first two arguments and if identical marks as $type
Parameters
- $helper
-
(mixed) (Required) One of the values to compare
- $current
-
(mixed) (Required) (true) The other value to compare if not just true
- $echo
-
(bool) (Required) Whether to echo or just return the string
- $type
-
(string) (Required) The type of checked|selected|disabled|readonly we are doing
Return
(string) HTML attribute or empty string
Source
File: wp-includes/general-template.php
function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
if ( (string) $helper === (string) $current ) {
$result = " $type='$type'";
} else {
$result = '';
}
if ( $echo ) {
echo $result;
}
return $result;
}
Changelog
Version | Description |
2.8.0 | Introduced. |