Comments: Make `wp_required_field_indicator()` and `wp_required_field_message()` output filterable.
This changeset introduces two new hooks: - `wp_required_field_indicator` allows developers to filter the HTML output of the `wp_required_field_indicator()` function. - `wp_required_field_message` does the same for the `wp_required_field_message()` function. The changeset also adds new phpunit tests for these filters. Follow-up to [53888], [54136]. Props kebbet, audrasjb, sabernhardt, costdev, mukesh27. Fixes #56389. See #54394. Built from https://develop.svn.wordpress.org/trunk@54137 git-svn-id: http://core.svn.wordpress.org/trunk@53696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6b6302f95e
commit
43b406a5ee
|
@ -5026,7 +5026,14 @@ function wp_required_field_indicator() {
|
||||||
$glyph = __( '*' );
|
$glyph = __( '*' );
|
||||||
$indicator = '<span class="required">' . esc_html( $glyph ) . '</span>';
|
$indicator = '<span class="required">' . esc_html( $glyph ) . '</span>';
|
||||||
|
|
||||||
return $indicator;
|
/**
|
||||||
|
* Filters the markup for a visual indicator of required form fields.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
*
|
||||||
|
* @param string $indicator Markup for the indicator element.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'wp_required_field_indicator', $indicator );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5043,7 +5050,14 @@ function wp_required_field_message() {
|
||||||
sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator() )
|
sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator() )
|
||||||
);
|
);
|
||||||
|
|
||||||
return $message;
|
/**
|
||||||
|
* Filters the message to explain required form fields.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
*
|
||||||
|
* @param string $message Message text and glyph wrapped in a `span` tag.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'wp_required_field_message', $message );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-alpha-54136';
|
$wp_version = '6.1-alpha-54137';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue