klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

Flash message params? #294

Closed seanmcn closed 9 years ago

seanmcn commented 9 years ago

$service->flash($msg, $type = 'info', $params = array())

What is the use of $params here? I expected adding a paramter would make it available with the flash message, which doesn't seem to be the case. I was trying to do something like :

$this->klein->service()->flash('Record Updated', 'success', array('heading' => '<h4><i class="icon fa fa-check"></i>Success!</h4>'));

jk3us commented 9 years ago

The $params is an array that gets passed (with the message) to vsprintf(). So, you could do something like

$service->flash("%d records updated.", 'success', [4]);

and it will flash "4 records updated".

seanmcn commented 9 years ago

Ah, okay thanks for the clarification!