Outil de recherche WordPress pour les développeurs et auteurs de thèmes



__checked_selected_helper ›

Depuis2.8.0
Dépréciéen/a
__checked_selected_helper ( $helper, $current, $echo, $type )
Accès:
  • private
Paramètres: (4)
  • (mixed) $helper One of the values to compare
    Requis: Oui
  • (mixed) $current (true) The other value to compare if not just true
    Requis: Oui
  • (bool) $echo Whether to echo or just return the string
    Requis: Oui
  • (string) $type The type of checked|selected|disabled|readonly we are doing
    Requis: Oui
Retourne:
  • (string) html attribute or empty string
Défini(e) dans:
Codex:

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

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



Source

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;
}