-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Notice templates #6
Comments
This would mean introducing:
I'm imagining the interface will be something like: interface NoticeTemplateInterface {
public function render(AdminNotice $notice, array $wrapperAttributes, array $dismissClasses)
} While the template could derive the attributes and classes itself from the notice, I feel like providing them directly would help future-proof any changes to them, as well as handle the namespacing so the template doesn't have to worry about that. Should the namespace be provided to the template? Perhaps for adding their own things, but since it's custom already it may just be unnecessary as the namespacing is most important for built-in features. |
I would say that namespacing for templates isn't needed. Notices have ids, devs can use whatever they want there to differentiate notices, templates are custom code - managed by devs as well, so imo we are good. |
Thanks, @slaFFik! Yeah, I'm leaning more in that direction. |
The standard WP notice is nice, but not particularly inspiring. Some products want to use their own style of notification — that's branded or just more modern looking. Right now a callback can be used for the notice content without the wrapper to accomplish this, but it's more cumbersome to do. It would be cool to have a formal templating system!
I'm imagining something like the following:
This would keep the syntax nice and simple. It might be cool to also have:
The text was updated successfully, but these errors were encountered: