It also sets the proper language variables (if not already set per dca-config.php or similar).
Using the optional override parameter, settings known by this attribute can be overridden for the
generating of the output array.
public getFieldDefinition ( array $arrOverrides = [] ) : array | ||
$arrOverrides | array | The values to override, for a list of valid parameters, call getAttributeSettingNames(). |
Результат | array | The DCA array to use as $GLOBALS['TL_DCA']['tablename']['fields']['attribute-name] |
/** * Instantiate the field an set all values * * @param array $data * @param MetaModel $objMM */ public function __construct(array $data, MetaModel $objMM) { $this->mmAttribute = $objMM->getAttributeById($data['attr_id']); $this->colName = $this->mmAttribute->get('colname'); $dcaArray = $this->mmAttribute->getFieldDefinition($data); $this->eval = $dcaArray['eval']; unset($dcaArray['eval']); $this->data = $dcaArray; if ($data['tl_class']) { $this->addEval('class', $data['tl_class']); } /** * Check for inputType and convert if necessary */ switch ($this->get('inputType')) { case 'fileTree': $this->set('inputType', 'upload'); $this->fieldType = 'upload'; break; } if (is_a($this->mmAttribute, '\\MetaModels\\Attribute\\Url\\Url')) { $this->set('inputType', 'beUrl'); $this->fieldType = 'complex'; } if (is_a($this->mmAttribute, '\\MetaModels\\Attribute\\IComplex')) { $this->fieldType = 'complex'; } /** * Check for RTE support on longtext fields */ if (is_a($this->mmAttribute, '\\MetaModels\\Attribute\\Longtext\\Longtext')) { if (isset($data['rte']) && !empty($data['rte'])) { $this->rte = $data['rte']; $class = $this->getEval('class') . ' ' . $data['rte']; if (!$this->modifyEval('class', $class)) { $this->addEval('class', $class); } } } /** * Get option values from select attributes */ if (is_a($this->mmAttribute, '\\MetaModels\\Attribute\\Select\\AbstractSelect')) { $this->set('options', $this->mmAttribute->getFilterOptions(null, false)); } /** * Add Save Handler */ switch ($this->fieldType) { case 'upload': $this->setSaveHandler(new UploadSaveHandler($this)); break; default: $this->setSaveHandler(new SaveHandler($this)); break; } }