From 594b10b0cf452b6adbda8b7a82e0bf4aed9d70c1 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Fri, 6 Oct 2017 14:24:55 +0200 Subject: [PATCH] Rework leaflet state button callbacks to be compatible with toolkit 3.0. --- src/Resources/contao/dca/tl_leaflet_control.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_icon.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_layer.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_marker.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_popup.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_style.php | 13 +++++++++---- src/Resources/contao/dca/tl_leaflet_vector.php | 13 +++++++++---- 7 files changed, 63 insertions(+), 28 deletions(-) diff --git a/src/Resources/contao/dca/tl_leaflet_control.php b/src/Resources/contao/dca/tl_leaflet_control.php index da68fe9..08bf1dd 100644 --- a/src/Resources/contao/dca/tl_leaflet_control.php +++ b/src/Resources/contao/dca/tl_leaflet_control.php @@ -86,10 +86,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_control', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array ( diff --git a/src/Resources/contao/dca/tl_leaflet_icon.php b/src/Resources/contao/dca/tl_leaflet_icon.php index 69b6980..f14ff5a 100644 --- a/src/Resources/contao/dca/tl_leaflet_icon.php +++ b/src/Resources/contao/dca/tl_leaflet_icon.php @@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_icon', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array ( diff --git a/src/Resources/contao/dca/tl_leaflet_layer.php b/src/Resources/contao/dca/tl_leaflet_layer.php index 5f8a2c0..2e5f3d5 100644 --- a/src/Resources/contao/dca/tl_leaflet_layer.php +++ b/src/Resources/contao/dca/tl_leaflet_layer.php @@ -114,10 +114,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_layer', - 'active' - ), + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ], 'show' => [ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['show'], diff --git a/src/Resources/contao/dca/tl_leaflet_marker.php b/src/Resources/contao/dca/tl_leaflet_marker.php index 1b7f999..dda7d75 100644 --- a/src/Resources/contao/dca/tl_leaflet_marker.php +++ b/src/Resources/contao/dca/tl_leaflet_marker.php @@ -100,10 +100,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_marker', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array ( diff --git a/src/Resources/contao/dca/tl_leaflet_popup.php b/src/Resources/contao/dca/tl_leaflet_popup.php index b96dccf..2269ec0 100644 --- a/src/Resources/contao/dca/tl_leaflet_popup.php +++ b/src/Resources/contao/dca/tl_leaflet_popup.php @@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_popup', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array ( diff --git a/src/Resources/contao/dca/tl_leaflet_style.php b/src/Resources/contao/dca/tl_leaflet_style.php index 5c662fc..3d436a6 100644 --- a/src/Resources/contao/dca/tl_leaflet_style.php +++ b/src/Resources/contao/dca/tl_leaflet_style.php @@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_style', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array ( diff --git a/src/Resources/contao/dca/tl_leaflet_vector.php b/src/Resources/contao/dca/tl_leaflet_vector.php index b10982f..d70f973 100644 --- a/src/Resources/contao/dca/tl_leaflet_vector.php +++ b/src/Resources/contao/dca/tl_leaflet_vector.php @@ -109,10 +109,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', - 'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( - 'tl_leaflet_vector', - 'active' - ) + 'button_callback' => [ + 'netzmacht.contao_toolkit.dca.listeners.state_button_callback', + 'handleButtonCallback' + ], + 'toolkit' => [ + 'state_button' => [ + 'stateColumn' => ['active'] + ] + ], ), 'show' => array (