Simplify code used to generate plugin flash messages.

This commit is contained in:
mark_story 2015-10-17 20:59:02 -04:00
parent fd50d1976a
commit 925647ae2b

View file

@ -38,7 +38,6 @@ class FlashComponent extends Component {
'key' => 'flash',
'element' => 'default',
'params' => array(),
'plugin' => '',
);
/**
@ -77,17 +76,11 @@ class FlashComponent extends Component {
$message = $message->getMessage();
}
list($plugin, $element) = pluginSplit($options['element']);
if ($plugin) {
$options['plugin'] = $plugin;
}
list($plugin, $element) = pluginSplit($options['element'], true);
if (!empty($options['plugin'])) {
$options['element'] = $options['plugin'] . '.Flash/' . $element;
} else {
$options['element'] = 'Flash/' . $element;
$plugin = $options['plugin'] . '.';
}
$options['element'] = $plugin . 'Flash/' . $element;
CakeSession::write('Message.' . $options['key'], array(
'message' => $message,