Skip to content

Commit

Permalink
Use the PaletteManipulator (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar authored Aug 2, 2023
1 parent 9bb999c commit 4f45963
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Resources/contao/dca/tl_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
* @author Martin Auswöger <[email protected]>
*/

$GLOBALS['TL_DCA']['tl_user']['palettes']['extend'] = str_replace('formp;', 'formp;{rocksolid_frontend_helper_legend},rocksolidFrontendHelperOperations,rocksolidFrontendHelperContentElements;', $GLOBALS['TL_DCA']['tl_user']['palettes']['extend']);
$GLOBALS['TL_DCA']['tl_user']['palettes']['custom'] = str_replace('formp;', 'formp;{rocksolid_frontend_helper_legend},rocksolidFrontendHelperOperations,rocksolidFrontendHelperContentElements;', $GLOBALS['TL_DCA']['tl_user']['palettes']['custom']);
\Contao\CoreBundle\DataContainer\PaletteManipulator::create()
->addLegend('rocksolid_frontend_helper_legend', 'forms_legend')
->addField('rocksolidFrontendHelperOperations', 'rocksolid_frontend_helper_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->addField('rocksolidFrontendHelperContentElements', 'rocksolid_frontend_helper_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->applyToPalette('extend', 'tl_user')
->applyToPalette('custom', 'tl_user')
;

$GLOBALS['TL_DCA']['tl_user']['palettes']['admin'] = preg_replace('(([,;}]useCE)([,;{]))i', '$1,rocksolidFrontendHelper,rocksolidFrontendHelperLightbox$2', $GLOBALS['TL_DCA']['tl_user']['palettes']['admin']);
$GLOBALS['TL_DCA']['tl_user']['palettes']['default'] = preg_replace('(([,;}]useCE)([,;{]))i', '$1,rocksolidFrontendHelper,rocksolidFrontendHelperLightbox$2', $GLOBALS['TL_DCA']['tl_user']['palettes']['default']);
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/dca/tl_user_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
* @author Martin Auswöger <[email protected]>
*/

$GLOBALS['TL_DCA']['tl_user_group']['palettes']['default'] = str_replace('formp;', 'formp;{rocksolid_frontend_helper_legend},rocksolidFrontendHelperOperations,rocksolidFrontendHelperContentElements;', $GLOBALS['TL_DCA']['tl_user_group']['palettes']['default']);
\Contao\CoreBundle\DataContainer\PaletteManipulator::create()
->addLegend('rocksolid_frontend_helper_legend', 'forms_legend')
->addField('rocksolidFrontendHelperOperations', 'rocksolid_frontend_helper_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->addField('rocksolidFrontendHelperContentElements', 'rocksolid_frontend_helper_legend', \Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_user_group')
;

$GLOBALS['TL_DCA']['tl_user_group']['fields']['rocksolidFrontendHelperOperations'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_user']['rocksolidFrontendHelperOperations'],
Expand Down

0 comments on commit 4f45963

Please sign in to comment.