Skip to content

Idea: Notice templates #6

@JasonTheAdams

Description

@JasonTheAdams

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:

AdminNotices::registerTemplate('pretty-template', PrettyTemplate::class)

AdminNotice->show('pretty-notice', 'Hello world!')
  ->template('pretty-template')

This would keep the syntax nice and simple. It might be cool to also have:

AdminNotices::setDefaultTemplate('pretty-template');

AdminNotice::show('pretty-by-default', 'So pretty!');
AdminNotice::show('default', 'Using the default template')
  ->defaultTemplate();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions