On this page
__checked_selected_helper( mixed $helper, mixed $current, bool $echo, string $type ): string
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Private helper function for checked, selected, disabled and readonly.
Description
Compares the first two arguments and if identical marks as $type.
Parameters
$helpermixed Required-
One of the values to compare.
$currentmixed Required-
The other value to compare if not just true.
$echobool Required-
Whether to echo or just return the string.
$typestring Required-
The type of
checked|selected|disabled|readonlywe are doing.
Return
string HTML attribute or empty string.
Source
File: wp-includes/general-template.php. View all references
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;
}
Related
Used By
| Used By | Description |
|---|---|
| wp_readonly() wp-includes/general-template.php | Outputs the HTML readonly attribute. |
| checked() wp-includes/general-template.php | Outputs the HTML checked attribute. |
| selected() wp-includes/general-template.php | Outputs the HTML selected attribute. |
| disabled() wp-includes/general-template.php | Outputs the HTML disabled attribute. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/__checked_selected_helper