mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens. Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov. Fixes #54394. git-svn-id: https://develop.svn.wordpress.org/trunk@53888 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2354,8 +2354,9 @@ function comment_form( $args = array(), $post = null ) {
|
||||
$required_attribute = ( $html5 ? ' required' : ' required="required"' );
|
||||
$checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' );
|
||||
|
||||
// Identify required fields visually.
|
||||
$required_indicator = ' <span class="required" aria-hidden="true">*</span>';
|
||||
// Identify required fields visually and create a message about the indicator.
|
||||
$required_indicator = ' ' . wp_required_field_indicator();
|
||||
$required_text = ' ' . wp_required_field_message();
|
||||
|
||||
$fields = array(
|
||||
'author' => sprintf(
|
||||
@@ -2420,12 +2421,6 @@ function comment_form( $args = array(), $post = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
$required_text = sprintf(
|
||||
/* translators: %s: Asterisk symbol (*). */
|
||||
' <span class="required-field-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>',
|
||||
trim( $required_indicator )
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the default comment form fields.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user