Hallo,
ich versuche gerade die Events umzuschreiben wenn eine bestimmte Kalenderart gewählt wurde. Das klappt auch allerdings fügt es das Feld "fs_location" mir nicht ein.
1.
PHP-Code:
class FsCalendarEventsListener
{
public function onLoadCallback(DataContainer $dc): void
{
$pidObj = CalendarEventsModel::findOneBy("id", Input::get('id'), array());
$parentConfig = CalendarModel::findOneBy("id", $pidObj->pid, array());
if($parentConfig->fs_calendar_art == 'concert') {
$GLOBALS['TL_DCA'][$dc->table]['fields']['title']['eval']['mandatory'] = false;
$palette = '{date_legend},startDate,endDate;{details_legend];{publish_legend},published';
PaletteManipulator::create()
->addField('fs_location', 'details_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', $dc->table);
} else {
$palette = $GLOBALS['TL_DCA'][$dc->table]['palettes']['default'];
}
$GLOBALS['TL_DCA'][$dc->table]['palettes']['default'] = $palette;
}
}
2.
kann man die Funktion "create_location_options" auch mit in den FsCalendarEventsListener packen? Oder wo kommt sowas jetzt hin?
PHP-Code:
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['fs_location'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_calendar_events']['fs_location'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_calendar_events_fs_bundle','create_location_options'),
'eval' => array('mandatory'=>true,'style' => 'width:250px','includeBlankOption'=>false,'chosen'=>true,'tl_class'=>'w50'),
'sql' => "int(4) unsigned NOT NULL default '0'",
'foreignKey' => 'tl_fs_locations.title',
'relation' => array('type'=>'hasOne', 'load'=>'eager')
);
Lesezeichen