Rework leaflet state button callbacks to be compatible with toolkit 3.0.

This commit is contained in:
David Molineus
2017-10-06 14:24:55 +02:00
parent ad6a4e9384
commit 594b10b0cf
7 changed files with 63 additions and 28 deletions

View File

@@ -86,10 +86,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_control', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (

View File

@@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_icon', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (

View File

@@ -114,10 +114,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_layer', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
), ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
], ],
'show' => [ 'show' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['show'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['show'],

View File

@@ -100,10 +100,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_marker', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (

View File

@@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_popup', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (

View File

@@ -101,10 +101,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_style', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (

View File

@@ -109,10 +109,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'],
'icon' => 'visible.gif', 'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton( 'button_callback' => [
'tl_leaflet_vector', 'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'active' 'handleButtonCallback'
) ],
'toolkit' => [
'state_button' => [
'stateColumn' => ['active']
]
],
), ),
'show' => array 'show' => array
( (