Last active
October 13, 2015 06:28
-
-
Save stefansl/4153780 to your computer and use it in GitHub Desktop.
Contao - limit subcolumn sets for user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Paste this into your /system/config/dcaconfig.php */ | |
/* Configuration: which types of sets should be in the selectmenu? */ | |
$allowed_gaptypes = array( '25x25x25x25','33x33x33','50x50' ); | |
if (is_array($GLOBALS['TL_SUBCL'])) { | |
foreach ( $GLOBALS['TL_SUBCL'] as $set_key => $value) | |
{ | |
foreach ( $GLOBALS['TL_SUBCL'][$set_key]['sets'] as $key => $value) | |
{ | |
if ( in_array($key, $allowed_gaptypes) == FALSE ) { | |
unset($GLOBALS['TL_SUBCL'][$set_key]['sets'][$key]); | |
} | |
} | |
} | |
} | |
/* Autofill the gap with value 50 */ | |
$GLOBALS['TL_DCA']['tl_content']['fields']['sc_gap']['default'] = '50'; |
$allowed_gaptypes = array( '20x20x20x20x20','25x25x25x25','33x33x33','50x50' );
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent!