From 644d4e41341b0f4460c2fc9d842fbc25b1178183 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_comments.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contao/dca/tl_comments.php b/contao/dca/tl_comments.php index a15a8fc8d0..60abb8f6d9 100644 --- a/contao/dca/tl_comments.php +++ b/contao/dca/tl_comments.php @@ -631,8 +631,15 @@ public function toggleVisibility($intId, $blnVisible) { foreach ($GLOBALS['TL_DCA']['tl_comments']['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); + } } }