WordPress.org

Make WordPress Core

Changeset 41728


Ignore:
Timestamp:
10/04/2017 01:18:16 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Template: Introduce readonly() form helper to complement the disabled() helper added in [13658].

Props soulseekah.
Fixes #16886.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r41558 r41728  
    41944194
    41954195/**
    4196  * Private helper function for checked, selected, and disabled.
     4196 * Outputs the html readonly attribute.
     4197 *
     4198 * Compares the first two arguments and if identical marks as readonly
     4199 *
     4200 * @since 4.9.0
     4201 *
     4202 * @param mixed $readonly One of the values to compare
     4203 * @param mixed $current  (true) The other value to compare if not just true
     4204 * @param bool  $echo     Whether to echo or just return the string
     4205 * @return string html attribute or empty string
     4206 */
     4207function readonly( $readonly, $current = true, $echo = true ) {
     4208    return __checked_selected_helper( $readonly, $current, $echo, 'readonly' );
     4209}
     4210
     4211/**
     4212 * Private helper function for checked, selected, disabled and readonly.
    41974213 *
    41984214 * Compares the first two arguments and if identical marks as $type
     
    42044220 * @param mixed  $current (true) The other value to compare if not just true
    42054221 * @param bool   $echo    Whether to echo or just return the string
    4206  * @param string $type    The type of checked|selected|disabled we are doing
     4222 * @param string $type    The type of checked|selected|disabled|readonly we are doing
    42074223 * @return string html attribute or empty string
    42084224 */
Note: See TracChangeset for help on using the changeset viewer.