Skip to content

Commit

Permalink
Added input type standardField
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed May 21, 2014
1 parent 99a6aa1 commit fca1379
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/MadeYourDay/Contao/CustomElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,38 @@ protected function createDcaItem($fieldPrefix, $fieldName, $fieldConfig, &$palet
);
$paletteFields[] = $fieldPrefix . $fieldName . '_rsce_list_stop';

}
else if ($fieldConfig['inputType'] === 'standardField') {

if ($fieldPrefix !== 'rsce_field_') {
throw new \Exception('Input type "standardField" is not allowed inside lists.');
}

if (isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName])) {

if (
isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName]['eval'])
&& is_array($GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName]['eval'])
&& isset($fieldConfig['eval'])
&& is_array($fieldConfig['eval'])
) {
$fieldConfig['eval'] = array_merge(
$GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName]['eval'],
$fieldConfig['eval']
);
}

unset($fieldConfig['inputType']);

$GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName] = array_merge(
$GLOBALS['TL_DCA'][$dc->table]['fields'][$fieldName],
$fieldConfig
);

$paletteFields[] = $fieldName;

}

}
else {

Expand Down

0 comments on commit fca1379

Please sign in to comment.