diff --git a/modules/ui_patterns_ds/src/FieldTemplateProcessor.php b/modules/ui_patterns_ds/src/FieldTemplateProcessor.php index 3f946791..bf9826f0 100644 --- a/modules/ui_patterns_ds/src/FieldTemplateProcessor.php +++ b/modules/ui_patterns_ds/src/FieldTemplateProcessor.php @@ -58,9 +58,14 @@ public function process(array &$variables) { public function getSourceValue(array $mapping, $delta) { $value = $this->variables['items'][$delta]['content']; if ($mapping['source'] != $this->getFieldName()) { - $column = $this->getColumnName($mapping['source']); - $value = $this->getEntity()->get($this->getFieldName())->getValue(); - $value = $value[$delta][$column]; + if ($mapping['source'] == 'label') { + $value = $this->getEntity()->getFieldDefinition($this->getFieldName())->label(); + } + else { + $column = $this->getColumnName($mapping['source']); + $value = $this->getEntity()->get($this->getFieldName())->getValue(); + $value = $value[$delta][$column]; + } } return $value; } diff --git a/modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldTemplateSource.php b/modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldTemplateSource.php index f391db1a..317f1537 100644 --- a/modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldTemplateSource.php +++ b/modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldTemplateSource.php @@ -65,6 +65,9 @@ public function getSourceFields() { foreach ($field->getFieldStorageDefinition()->getColumns() as $column_name => $column) { $sources[] = $this->getSourceField($field_name . '__' . $column_name, $label . ': ' . $column_name); } + + // Add the field label as a source as well + $sources[] = $this->getSourceField('label', $label . ': label'); return $sources; }