Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Improving FlashAndRedirectTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Jul 18, 2017
1 parent fc88906 commit e9e869a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Controller/Component/FlashAndRedirectTrait.php
Expand Up @@ -10,6 +10,8 @@

/**
* FlashAndRedirectTrait
*
* @property \Cake\Controller\ComponentRegistry $_registry
*/
trait FlashAndRedirectTrait {

Expand Down Expand Up @@ -71,8 +73,12 @@ protected function _handleFlash($type, $options) {
}

if (!isset($flashOptions['element'])) {
if (!$this->_registry->has('Flash')) {
$this->_registry->load('Flash');
}

$flashOptions['element'] = $type;
$this->Flash->set($options[$type . 'Message'], $flashOptions);
$this->_registry->get('Flash')->set($options[$type . 'Message'], $flashOptions);
}

return true;
Expand Down

0 comments on commit e9e869a

Please sign in to comment.