[wp-trac] [WordPress Trac] #44640: Use current `.notice` CSS classes for settings errors
WordPress Trac
noreply at wordpress.org
Fri Apr 5 14:15:32 UTC 2019
#44640: Use current `.notice` CSS classes for settings errors
----------------------------+-----------------------------
Reporter: flixos90 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+-----------------------------
Changes (by toddhalfpenny):
* keywords: needs-patch => has-patch
Comment:
Wondering if the following approach is valid. I did wonder about putting
the mapping into it's own function, but seemed overkill.
**WAS**
{{{#!php
foreach ( $settings_errors as $key => $details ) {
$css_id = 'setting-error-' . $details['code'];
$css_class = $details['type'] . ' settings-error notice
is-dismissible';
$output .= "<div id='$css_id' class='$css_class'> \n";
$output .=
"<p><strong>{$details['message']}</strong></p>";
$output .= "</div> \n";
}
}}}
**Proposed**
{{{#!php
foreach ( $settings_errors as $key => $details ) {
$type_css_class = '';
switch ( $details['type'] ) {
case 'error':
$type_css_class = 'notice-error';
break;
case 'updated':
$type_css_class = 'notice-success';
break;
}
$css_id = 'setting-error-' . $details['code'];
$css_class = $type_css_class . ' settings-error notice is-
dismissible';
$output .= "<div id='$css_id' class='$css_class'> \n";
$output .=
"<p><strong>{$details['message']}</strong></p>";
$output .= "</div> \n";
}
}}}
Tested (by saving "General Settings" with empty email address.
If this looks good will create a patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44640#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list