Template: Introduce `readonly()` form helper to complement the `disabled()` helper added in [13658].
Props soulseekah. Fixes #16886. Built from https://develop.svn.wordpress.org/trunk@41728 git-svn-id: http://core.svn.wordpress.org/trunk@41562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f276b4901b
commit
e29c2f560b
|
@ -4193,7 +4193,23 @@ function disabled( $disabled, $current = true, $echo = true ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Private helper function for checked, selected, and disabled.
|
||||
* Outputs the html readonly attribute.
|
||||
*
|
||||
* Compares the first two arguments and if identical marks as readonly
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @param mixed $readonly One of the values to compare
|
||||
* @param mixed $current (true) The other value to compare if not just true
|
||||
* @param bool $echo Whether to echo or just return the string
|
||||
* @return string html attribute or empty string
|
||||
*/
|
||||
function readonly( $readonly, $current = true, $echo = true ) {
|
||||
return __checked_selected_helper( $readonly, $current, $echo, 'readonly' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Private helper function for checked, selected, disabled and readonly.
|
||||
*
|
||||
* Compares the first two arguments and if identical marks as $type
|
||||
*
|
||||
|
@ -4203,7 +4219,7 @@ function disabled( $disabled, $current = true, $echo = true ) {
|
|||
* @param mixed $helper One of the values to compare
|
||||
* @param mixed $current (true) The other value to compare if not just true
|
||||
* @param bool $echo Whether to echo or just return the string
|
||||
* @param string $type The type of checked|selected|disabled we are doing
|
||||
* @param string $type The type of checked|selected|disabled|readonly we are doing
|
||||
* @return string html attribute or empty string
|
||||
*/
|
||||
function __checked_selected_helper( $helper, $current, $echo, $type ) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41727';
|
||||
$wp_version = '4.9-alpha-41728';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue