From 0c1ed0b4a43fd8e6f07d283501f65b74722ce1b5 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) --- src/Resources/contao/dca/tl_calendar_events.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Resources/contao/dca/tl_calendar_events.php b/src/Resources/contao/dca/tl_calendar_events.php index 7e39f97b60..565c844516 100644 --- a/src/Resources/contao/dca/tl_calendar_events.php +++ b/src/Resources/contao/dca/tl_calendar_events.php @@ -994,8 +994,15 @@ public function toggleVisibility($intId, $blnVisible) { foreach ($GLOBALS['TL_DCA']['tl_calendar_events']['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); + } } }