[wp-trac] [WordPress Trac] #44941: Support `warning` and `info` type notices in settings errors

WordPress Trac noreply at wordpress.org
Wed Aug 21 15:06:45 UTC 2019


#44941: Support `warning` and `info` type notices in settings errors
-------------------------------------------------+-------------------------
 Reporter:  desrosj                              |       Owner:
                                                 |  SergeyBiryukov
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.3
Component:  Administration                       |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots needs-dev-note       |     Focuses:
  needs-patch                                    |  administration
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch has-screenshots needs-dev-note => has-screenshots
     needs-dev-note needs-patch
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:10 afercia]:
 > Minor: worth noting the changes in [45814] break plugins that are (with
 good intent) passing a proper CSS class. For example, if a plugin passes
 `notice-error`, the CSS class printed out will now be `notice-notice-
 error`. Maybe worth considering a quick dev note. See also #44640.

 Good catch, we should only add `notice-` if it doesn't already exist, and
 only to `error`, `success`, `warning`, `info`, not other random classes.

 > Also, one could pass a string like the following:
 >
 > `error my-own-css-class hello world`
 >
 > and actually get the following (spaces are stripped out by
 `sanitize_html_class()`):
 >
 > `notice notice-errormy-own-css-classhelloworld settings-error is-
 dismissible`

 I guess I was a bit overzealous with `sanitize_html_class()`, `esc_attr()`
 could be used instead.

 Looks like this needs some more work, I don't think we should break
 backward compatibility here.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44941#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list