Make WordPress Core

Changeset 57128 for trunk


Ignore:
Timestamp:
11/20/2023 12:06:08 AM (11 months ago)
Author:
SergeyBiryukov
Message:

Administration: Standardize default values in submit_button().

This commit updates the submit_button() function to standardize the default values of $text and $other_attributes parameters. Previously set to null, these defaults have now been changed to an empty string (''), bringing consistency with the get_submit_button() function, which submit_button() wraps.

The change maintains backward compatibility, as get_submit_button() does not perform strict type-checking on these parameters. This update aligns with the ongoing effort to standardize function parameters across the WordPress codebase, improving the readability and predictability of the core functions.

Follow-up to [31446].

Props andbalashov.
Fixes #59921.

File:
1 edited

Legend:

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

    r57114 r57128  
    25542554 *                                       where attribute is the key. Attributes can also be provided as a string,
    25552555 *                                       e.g. `id="search-submit"`, though the array format is generally preferred.
    2556  *                                       Default null.
    2557  */
    2558 function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
     2556 *                                       Default empty string.
     2557 */
     2558function submit_button( $text = '', $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = '' ) {
    25592559    echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
    25602560}
Note: See TracChangeset for help on using the changeset viewer.