Browse Source

Including option for plugin name in __call()

Once __call() always override the $options['element'] for instance set(), I added a plugin key in $args
André Teixeira 11 years ago
parent
commit
e49ba8bb16
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/Controller/Component/FlashComponent.php

+ 7 - 1
src/Controller/Component/FlashComponent.php

@@ -113,13 +113,19 @@ class FlashComponent extends Component
      */
     public function __call($name, $args)
     {
-        $options = ['element' => Inflector::underscore($name)];
+        $element = Inflector::underscore($name);
 
         if (count($args) < 1) {
             throw new InternalErrorException('Flash message missing.');
         }
 
+        $options = ['element' => $element];
+
         if (!empty($args[1])) {
+            if (!empty($args[1]['plugin'])) {
+                $options = ['element' => $args[1]['plugin'] . '.' . $element];
+                unset($args[1]['plugin']);
+            }
             $options += (array)$args[1];
         }