Skip to content

Commit

Permalink
Fix missing plugin name from alert's element string.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadb committed Feb 27, 2014
1 parent 61c044c commit c73947a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Controller/CommonAppController.php
Expand Up @@ -147,20 +147,21 @@ public function alert($msg, $options = array()) {
$params = array('code' => $options['code'], 'plugin' => $options['plugin']); $params = array('code' => $options['code'], 'plugin' => $options['plugin']);


// View element // View element
$element = explode('/', $options['element']); $element = $options['element'];
if (!empty($this->params['prefix'])) { if (!empty($this->params['prefix'])) {
$element = explode('/', $options['element']);
array_push($element, $this->params['prefix'] . '_' . array_pop($element)); array_push($element, $this->params['prefix'] . '_' . array_pop($element));
$element = implode('/', $element);
} }

$elementPath = 'View' . DS . 'Elements' . DS . implode('/', $element) . '.ctp'; $elementPath = 'View' . DS . 'Elements' . DS . $element . '.ctp';
if (!empty($options['plugin']) && CakePlugin::loaded($options['plugin'])) { if (!empty($options['plugin']) && CakePlugin::loaded($options['plugin'])) {
$element = $options['plugin'] . '.' . $element;
$elementPath = CakePlugin::path($options['plugin']) . $elementPath; $elementPath = CakePlugin::path($options['plugin']) . $elementPath;
} }


if (!is_file($elementPath)) { if (!is_file($elementPath)) {
$element = $defaults['element']; $element = $defaults['element'];
} else {
$element = implode('/', $element);
} }


// Redirect URL // Redirect URL
Expand Down

0 comments on commit c73947a

Please sign in to comment.