Skip to content
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

[NFR]: add setIconCssClasses() method for Flash Messages #15292

Closed
escribiendocodigo opened this issue Feb 13, 2021 · 3 comments
Closed

[NFR]: add setIconCssClasses() method for Flash Messages #15292

escribiendocodigo opened this issue Feb 13, 2021 · 3 comments
Labels
5.0 The issues we want to solve in the 5.0 release new feature request Planned Feature or New Feature Request

Comments

@escribiendocodigo
Copy link
Contributor

$flash->setIconCssClasses([
        'error'   => 'fas fa-exclamation-triangle',
        'success' => 'fas fa-check-circle',
        'notice'  => 'fas fa-info-circle',
        'warning' => 'fas fa-exclamation-triangle'
]);

Full example

<?php

use Phalcon\Escaper;
use Phalcon\Flash\Direct;


$escaper = new Escaper();
$flash   = new Direct($escaper);

$customTemplate = '<div class="%cssClass%">
                       <i class="%iconCssClass%"></i>
                       %message%
                       <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                   </div>';



$flash->setCustomTemplate($customTemplate);
$flash->setCssClasses([
        'error'   => 'alert alert-danger alert-dismissible',
        'success' => 'alert alert-success alert-dismissible',
        'notice'  => 'alert alert-info alert-dismissible',
        'warning' => 'alert alert-warning alert-dismissible'
]);
$flash->setIconCssClasses([
        'error'   => 'fas fa-exclamation-triangle',
        'success' => 'fas fa-check-circle',
        'notice'  => 'fas fa-info-circle',
        'warning' => 'fas fa-exclamation-triangle'
]);


$flash->error('Something went wrong');
@escribiendocodigo escribiendocodigo changed the title [NFR] add setIconCssClasses() method for Flash Messages [NFR]: add setIconCssClasses() method for Flash Messages Feb 13, 2021
@Jeckerson
Copy link
Member

Hello. It is seem to be specific case template. What you can do, is extend Direct class and add desired method setIconCssClasses with specific case logic.

@escribiendocodigo
Copy link
Contributor Author

thanks

@Jeckerson Jeckerson added 6.0 The issues we want to solve in the 6.0 release transfer labels Mar 26, 2021
@stale stale bot added the stale Stale issue - automatically closed label Aug 11, 2021
@Jeckerson Jeckerson removed 6.0 The issues we want to solve in the 6.0 release transfer labels Aug 11, 2021
@niden niden added 5.0 The issues we want to solve in the 5.0 release new feature request Planned Feature or New Feature Request and removed stale Stale issue - automatically closed labels Aug 13, 2021
@niden niden mentioned this issue Aug 13, 2021
5 tasks
@phalcon phalcon deleted a comment from stale bot Aug 13, 2021
@niden niden reopened this Aug 13, 2021
@niden
Copy link
Member

niden commented Aug 16, 2021

Resolved in #15618

@niden niden closed this as completed Aug 16, 2021
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release new feature request Planned Feature or New Feature Request
Projects
Archived in project
Development

No branches or pull requests

3 participants