wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



__checked_selected_helper › WordPress Function

Od2.8.0
Przestarzałyn/a
__checked_selected_helper ( $helper, $current, $display, $type )
Dostęp:
  • private
Parametry: (4)
  • (mixed) $helper One of the values to compare.
    Wymagane: Tak
  • (mixed) $current The other value to compare if not just true.
    Wymagane: Tak
  • (bool) $display Whether to echo or just return the string.
    Wymagane: Tak
  • (string) $type The type of checked|selected|disabled|readonly we are doing.
    Wymagane: Tak
Powrót:
  • (string) HTML attribute or empty string.
Zdefiniowane na:
Codex:

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

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


Źródło

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