[wp-trac] [WordPress Trac] #30199: Add handling of a admin notice type "warning" to the WP admin.
WordPress Trac
noreply at wordpress.org
Thu Oct 30 17:30:02 UTC 2014
#30199: Add handling of a admin notice type "warning" to the WP admin.
--------------------------------+-----------------------------
Reporter: wedi | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords:
Focuses: ui, administration |
--------------------------------+-----------------------------
I'd like to suggest adding CSS for an admin notice type `warning` to the
WP Admin styles to allow nice formating and correct box movement of the
following:
1. Calling `add_settings_error()` with `$type = 'warning'` while working
with the Settings API.
2. `echo '<div class="warning"><p>A word of warning!</p></div>';` in a
`admin_notice` hook callback.
Right now, when a plugin author wants to display a warning message (e.g.,
a value that looks dangerous or cannot be verified) he has two options of
which both are ugly:
1. Hijack the update-nag class. Displays a yellow border which is nice for
a warning but has different margin/padding assigned and gets not moved
below the H2.
2. Use an own class, add own css to admin, add own JS to admin to move the
box. Works but requires a lot of work for a cosmetic issue and multiple
mixed messages of builtin and own types will loose their ordering as
`error` and `updated` message boxes get moved when builtin JS runs and own
class is either before or after that when cutom JS runs.
The patch attached adds the neccessary CSS and JS as well as documentation
for `add_settings_error()`.
A different approach to the provided patch would be introducing a new
class `admin-notice` which gets all message box styles applied and
triggers moving by the JS in common.js and `error` and `updated` are
reduced to applying the border colour. This would also reduce some
duplicated CSS and allow for adding more box types (e.g. a blue notice
box, a green box of envy, ...) easily.
So much text for such a small change... It's my first patch for WordPress
so please be kind if I made a mistake. :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30199>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list