public function EntityReferenceHierarchyLabelFormatter::settingsSummary in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x src/Plugin/Field/FieldFormatter/EntityReferenceHierarchyLabelFormatter.php \Drupal\entity_hierarchy\Plugin\Field\FieldFormatter\EntityReferenceHierarchyLabelFormatter::settingsSummary()
Returns a short summary for the current formatter settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.
Return value
string[] A short summary of the formatter settings.
Overrides EntityReferenceLabelFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ EntityReferenceHierarchyLabelFormatter.php, line 54
Class
- EntityReferenceHierarchyLabelFormatter
- Plugin implementation of the 'entity_hierarchy' formatter.
Namespace
Drupal\entity_hierarchy\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
switch ($this
->getSetting('weight_output')) {
case 'attribute':
$position = $this
->t('custom data-* attribute');
break;
case 'suffix':
$position = $this
->t('suffix after title');
break;
}
$summary[] = $this
->t('Show weight as @position', [
'@position' => $position,
]);
return $summary;
}