Skip to content

Instantly share code, notes, and snippets.

@stefansl
Last active Oct 13, 2015
Embed
What would you like to do?
Contao - limit subcolumn sets for user
/* 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';
@Hans-ChristianBenedict

This comment has been minimized.

Copy link

@Hans-ChristianBenedict Hans-ChristianBenedict commented Apr 9, 2015

Excellent!

@Hans-ChristianBenedict

This comment has been minimized.

Copy link

@Hans-ChristianBenedict Hans-ChristianBenedict commented Apr 9, 2015

$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