Changing the default layout to use FlashComponent::render instead of the deprecated SessionComponent::flash. Changing the flash elements to retain the id attribute that was previously present. Also fixing file permissions on the template files I added.

This commit is contained in:
mattmemmesheimer 2015-08-20 20:19:22 -05:00
parent 7d5e6e3a3e
commit 70feb52f73
5 changed files with 5 additions and 4 deletions

View file

@ -42,7 +42,7 @@ $cakeVersion = __d('cake_dev', 'CakePHP %s', Configure::version())
</div> </div>
<div id="content"> <div id="content">
<?php echo $this->Session->flash(); ?> <?php echo $this->Flash->render(); ?>
<?php echo $this->fetch('content'); ?> <?php echo $this->fetch('content'); ?>
</div> </div>

View file

@ -4,4 +4,4 @@ if (!empty($params['class'])) {
$class .= ' ' . $params['class']; $class .= ' ' . $params['class'];
} }
?> ?>
<div class="<?= h($class) ?>"><?= h($message) ?></div> <div id="<?= $key ?>Message" class="<?= h($class) ?>"><?= h($message) ?></div>

2
lib/Cake/View/Elements/Flash/error.ctp Executable file → Normal file
View file

@ -1 +1 @@
<div class="message error"><?= h($message) ?></div> <div id="<?= $key ?>Message" class="message error"><?= h($message) ?></div>

2
lib/Cake/View/Elements/Flash/success.ctp Executable file → Normal file
View file

@ -1 +1 @@
<div class="message success"><?= h($message) ?></div> <div id="<?= $key ?>Message" class="message success"><?= h($message) ?></div>

View file

@ -84,6 +84,7 @@ class FlashHelper extends AppHelper {
$flash = $options + $flash; $flash = $options + $flash;
CakeSession::delete("Message.$key"); CakeSession::delete("Message.$key");
$flash['key'] = $key;
return $this->_View->element($flash['element'], $flash); return $this->_View->element($flash['element'], $flash);
} }