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:
Sergey Biryukov 2017-10-04 13:19:48 +00:00
parent f276b4901b
commit e29c2f560b
2 changed files with 19 additions and 3 deletions

View File

@ -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 ) {

View File

@ -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.