Skip to content

Instantly share code, notes, and snippets.

@BugBuster1701
Created June 24, 2014 12:34
Show Gist options
  • Save BugBuster1701/aaa6ae1b34567526e47b to your computer and use it in GitHub Desktop.
Save BugBuster1701/aaa6ae1b34567526e47b to your computer and use it in GitHub Desktop.
dca, wizard, anonyme Funktion
'color' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_fp_gallery']['color'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Class', 'getColors'),
'eval' => array('tl_class'=>'w50 wizard'),
'wizard' => array
(
function($dc) {
$strReturn = '<div class="color_wizard" style="height:24px;width:24px;margin-left:5px;display:inline-block;background-color:#%s;"></div>';
$strReturn .= "<script>
window.addEvent('domready', function() {
var select = document.id('ctrl_$dc->field');
var colorWizard = select.getSiblings('div.color_wizard')[0];
select.addEvent('change', function() {
colorWizard.setStyle('background-color', '#' + this.value);
});
});
</script>";
$strColor = $dc->activeRecord->color ?: 'FFFFFF';
return sprintf($strReturn, $strColor);
}
),
'sql' => "varchar(6) NOT NULL default ''"
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment