diff --git a/ETwigViewRenderer.php b/ETwigViewRenderer.php index 4d8d543..1a90dcc 100644 --- a/ETwigViewRenderer.php +++ b/ETwigViewRenderer.php @@ -234,13 +234,13 @@ private function _addCustom($classType, $elements) $twigElement = null; switch ($func) { - // Just a name of function - case is_string($func): + // Callable (including just a name of function). + case is_callable($func): $twigElement = new $classFunction($func); break; - // Name of function + options array - case is_array($func) && is_string($func[0]) && isset($func[1]) && is_array($func[1]): - $twigElement = new $classFunction($func[0], $func[1]); + // Callable (including just a name of function) + options array. + case is_array($func) && is_callable($func[0]): + $twigElement = new $classFunction($func[0], (!empty($func[1]) && is_array($func[1])) ? $func[1] : []); break; }