Skip to content

Commit

Permalink
Changing the default layout to use FlashComponent::render instead of …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
mattmemmesheimer committed Aug 21, 2015
1 parent 7d5e6e3 commit 70feb52
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/View/Layouts/default.ctp
Expand Up @@ -42,7 +42,7 @@ $cakeVersion = __d('cake_dev', 'CakePHP %s', Configure::version())
</div>
<div id="content">

<?php echo $this->Session->flash(); ?>
<?php echo $this->Flash->render(); ?>

<?php echo $this->fetch('content'); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Elements/Flash/default.ctp
Expand Up @@ -4,4 +4,4 @@ if (!empty($params['class'])) {
$class .= ' ' . $params['class'];
}
?>
<div class="<?= h($class) ?>"><?= h($message) ?></div>
<div id="<?= $key ?>Message" class="<?= h($class) ?>"><?= h($message) ?></div>
2 changes: 1 addition & 1 deletion lib/Cake/View/Elements/Flash/error.ctp 100755 → 100644
@@ -1 +1 @@
<div class="message error"><?= h($message) ?></div>
<div id="<?= $key ?>Message" class="message error"><?= h($message) ?></div>
2 changes: 1 addition & 1 deletion lib/Cake/View/Elements/Flash/success.ctp 100755 → 100644
@@ -1 +1 @@
<div class="message success"><?= h($message) ?></div>
<div id="<?= $key ?>Message" class="message success"><?= h($message) ?></div>
1 change: 1 addition & 0 deletions lib/Cake/View/Helper/FlashHelper.php
Expand Up @@ -84,6 +84,7 @@ public function render($key = 'flash', $options = array()) {

$flash = $options + $flash;
CakeSession::delete("Message.$key");
$flash['key'] = $key;

return $this->_View->element($flash['element'], $flash);
}
Expand Down

0 comments on commit 70feb52

Please sign in to comment.