public function DsFieldTemplateSource::getSourceFields in UI Patterns 8
Return list of source fields.
Return value
\Drupal\ui_patterns\Definition\PatternSourceField[] List of source fields.
Overrides PatternSourceInterface::getSourceFields
File
- modules/
ui_patterns_ds/ src/ Plugin/ UiPatterns/ Source/ DsFieldTemplateSource.php, line 54
Class
- DsFieldTemplateSource
- Defines Display Suite field template source plugin.
Namespace
Drupal\ui_patterns_ds\Plugin\UiPatterns\SourceCode
public function getSourceFields() {
$sources = [];
$field_name = $this
->getContextProperty('field_name');
$entity_type = $this
->getContextProperty('entity_type');
$bundle = $this
->getContextProperty('bundle');
/** @var \Drupal\field\Entity\FieldConfig $field */
$field = $this->fieldManager
->getFieldDefinitions($entity_type, $bundle)[$field_name];
$label = $field
->getLabel();
$sources[] = $this
->getSourceField($field_name, $label);
foreach ($field
->getFieldStorageDefinition()
->getColumns() as $column_name => $column) {
$sources[] = $this
->getSourceField($field_name . '__' . $column_name, $label . ': ' . $column_name);
}
return $sources;
}