wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



__checked_selected_helper › WordPress Function

Seit2.8.0
Veraltetn/v
__checked_selected_helper ( $helper, $current, $display, $type )
Zugriff:
  • private
Parameter: (4)
  • (mixed) $helper One of the values to compare.
    Erforderlich: Ja
  • (mixed) $current The other value to compare if not just true.
    Erforderlich: Ja
  • (bool) $display Whether to echo or just return the string.
    Erforderlich: Ja
  • (string) $type The type of checked|selected|disabled|readonly we are doing.
    Erforderlich: Ja
Gibt zurück:
  • (string) HTML attribute or empty string.
Definiert in:
Codex:

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

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


Quellcode

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