From c696161d31d299470f796b9b410be612b88edb2e Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Fri, 20 Sep 2013 14:29:58 +0200 Subject: [PATCH] Support using closures as DCA callbacks (see #5772) --- contao/dca/tl_faq.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contao/dca/tl_faq.php b/contao/dca/tl_faq.php index 73cb5cb958..7e3fda8419 100644 --- a/contao/dca/tl_faq.php +++ b/contao/dca/tl_faq.php @@ -475,8 +475,15 @@ public function toggleVisibility($intId, $blnVisible) { foreach ($GLOBALS['TL_DCA']['tl_faq']['fields']['published']['save_callback'] as $callback) { - $this->import($callback[0]); - $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); + if (is_array($callback)) + { + $this->import($callback[0]); + $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); + } + elseif (is_callable($callback)) + { + $blnVisible = $callback($blnVisible, $this); + } } }