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.

git-svn-id: https://develop.svn.wordpress.org/trunk@57128 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2023-11-20 00:06:08 +00:00
parent 2a0d8fcd64
commit 30954f7ac0
+2 -2
View File
@@ -2553,9 +2553,9 @@ function compression_test() {
* These key/value attribute pairs will be output as `attribute="value"`,
* where attribute is the key. Attributes can also be provided as a string,
* e.g. `id="search-submit"`, though the array format is generally preferred.
* Default null.
* Default empty string.
*/
function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
function submit_button( $text = '', $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = '' ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}