protected function buildPropertyFromDca(PropertiesDefinitionInterface $definition, $propName, IInputScreen $inputScreen)
{
$property = $inputScreen->getProperty($propName);
$propInfo = $property['info'];
$metaModel = $this->getMetaModel();
$attribute = $metaModel->getAttribute($propName);
if (!$attribute || !$propInfo) {
return;
}
$isTranslated = $metaModel->isTranslated() && $attribute instanceof ITranslated;
if ($definition->hasProperty($propName)) {
$property = $definition->getProperty($propName);
} else {
$property = new DefaultProperty($propName);
$definition->addProperty($property);
}
if (!$property->getLabel() && isset($propInfo['label'])) {
$lang = $propInfo['label'];
if (is_array($lang)) {
$label = reset($lang);
$description = next($lang);
$property->setDescription($description);
} else {
$label = $lang;
}
$property->setLabel($label);
}
if (!$property->getDescription() && isset($propInfo['description'])) {
$property->setDescription($propInfo['description']);
}
if (!$property->getDefaultValue() && isset($propInfo['default'])) {
$property->setDefaultValue($propInfo['default']);
}
if (isset($propInfo['exclude'])) {
$property->setExcluded($propInfo['exclude']);
}
if (isset($propInfo['search'])) {
$property->setSearchable($propInfo['search']);
}
if (isset($propInfo['filter'])) {
$property->setFilterable($propInfo['filter']);
}
if (!$property->getWidgetType() && isset($propInfo['inputType'])) {
$property->setWidgetType($propInfo['inputType']);
}
if (!$property->getOptions() && isset($propInfo['options'])) {
$property->setOptions($propInfo['options']);
}
if (!$property->getExplanation() && isset($propInfo['explanation'])) {
$property->setExplanation($propInfo['explanation']);
}
if (isset($propInfo['eval'])) {
$extra = $propInfo['eval'];
if ($isTranslated) {
$extra['tl_class'] = 'translat-attr' . (!empty($extra['tl_class']) ? ' ' . $extra['tl_class'] : '');
}
$property->setExtra(array_merge((array) $property->getExtra(), $extra));
}
}