Make WordPress Core

Changeset 57114


Ignore:
Timestamp:
11/16/2023 05:00:28 PM (3 weeks ago)
Author:
SergeyBiryukov
Message:

Docs: Replace tabindex example in submit button functions documentation.

Most of the tabindex attributes across the admin were removed in [21311].

This commit updates the example for the $other_attributes parameter to use the id attribute instead.

Includes synchronizing documentation between submit_button() and get_submit_button().

Follow-up to [15810], [16061], [21311], [27136], [31599].

Props benjaminknox, sabernhardt, fushar, SergeyBiryukov.
Fixes #59768.

File:
1 edited

Legend:

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

    r57084 r57114  
    25412541 * @see get_submit_button()
    25422542 *
    2543  * @param string       $text             The text of the button (defaults to 'Save Changes')
     2543 * @param string       $text             Optional. The text of the button. Defaults to 'Save Changes'.
    25442544 * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
    25452545 *                                       include 'primary', 'small', and 'large'. Default 'primary'.
    2546  * @param string       $name             The HTML name of the submit button. Defaults to "submit". If no
    2547  *                                       id attribute is given in $other_attributes below, $name will be
    2548  *                                       used as the button's id.
    2549  * @param bool         $wrap             True if the output button should be wrapped in a paragraph tag,
    2550  *                                       false otherwise. Defaults to true.
    2551  * @param array|string $other_attributes Other attributes that should be output with the button, mapping
    2552  *                                       attributes to their values, such as setting tabindex to 1, etc.
    2553  *                                       These key/value attribute pairs will be output as attribute="value",
    2554  *                                       where attribute is the key. Other attributes can also be provided
    2555  *                                       as a string such as 'tabindex="1"', though the array format is
    2556  *                                       preferred. Default null.
     2546 * @param string       $name             Optional. The HTML name of the submit button. If no `id` attribute
     2547 *                                       is given in the `$other_attributes` parameter, `$name` will be used
     2548 *                                       as the button's `id`. Default 'submit'.
     2549 * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
     2550 *                                       false otherwise. Default true.
     2551 * @param array|string $other_attributes Optional. Other attributes that should be output with the button,
     2552 *                                       mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`.
     2553 *                                       These key/value attribute pairs will be output as `attribute="value"`,
     2554 *                                       where attribute is the key. Attributes can also be provided as a string,
     2555 *                                       e.g. `id="search-submit"`, though the array format is generally preferred.
     2556 *                                       Default null.
    25572557 */
    25582558function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
     
    25652565 * @since 3.1.0
    25662566 *
    2567  * @param string       $text             Optional. The text of the button. Default 'Save Changes'.
     2567 * @param string       $text             Optional. The text of the button. Defaults to 'Save Changes'.
    25682568 * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
    25692569 *                                       include 'primary', 'small', and 'large'. Default 'primary large'.
    2570  * @param string       $name             Optional. The HTML name of the submit button. Defaults to "submit".
    2571  *                                       If no id attribute is given in $other_attributes below, `$name` will
    2572  *                                       be used as the button's id. Default 'submit'.
    2573  * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph
    2574  *                                       tag, false otherwise. Default true.
     2570 * @param string       $name             Optional. The HTML name of the submit button. If no `id` attribute
     2571 *                                       is given in the `$other_attributes` parameter, `$name` will be used
     2572 *                                       as the button's `id`. Default 'submit'.
     2573 * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
     2574 *                                       false otherwise. Default true.
    25752575 * @param array|string $other_attributes Optional. Other attributes that should be output with the button,
    2576  *                                       mapping attributes to their values, such as `array( 'tabindex' => '1' )`.
    2577  *                                       These attributes will be output as `attribute="value"`, such as
    2578  *                                       `tabindex="1"`. Other attributes can also be provided as a string such
    2579  *                                       as `tabindex="1"`, though the array format is typically cleaner.
    2580  *                                       Default empty.
     2576 *                                       mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`.
     2577 *                                       These key/value attribute pairs will be output as `attribute="value"`,
     2578 *                                       where attribute is the key. Attributes can also be provided as a string,
     2579 *                                       e.g. `id="search-submit"`, though the array format is generally preferred.
     2580 *                                       Default empty string.
    25812581 * @return string Submit button HTML.
    25822582 */
Note: See TracChangeset for help on using the changeset viewer.