Skip to content

[NFR] Abilty to change the flash html template #13445

Closed
@JABirchall

Description

I recently ran into this. unless you pure bootstrap template the flash service is pretty useless and you need to write a custom flash class if you dont use bootstrap or have different template for errors and stuff like that.

Should add another method, setHtmlTemplate

$di->set('flash', function () {
    $flash = new Flash();
    $flash->setCssClasses([
        'error'   => 'alert alert-danger',
        'success' => 'alert alert-success',
        'notice'  => 'alert alert-info',
        'warning' => 'alert alert-warning'
    ]);
    $flash->setHtmlTemplate("<div class='{{ css }} alert-dismissible fade show m-alert m-alert--air' role='alert'>
	<button type='button' class='close' data-dismiss='alert' aria-label='Close'></button>
	{{ message }}
    </div>");
    retrun $flash;
});

Proposed version: 4.0 / 3.4.1?

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions