public function TermReferenceTree::settingsSummary in Taxonomy Term Reference Tree Widget 8
Same name in this branch
- 8 src/Plugin/Field/FieldFormatter/TermReferenceTree.php \Drupal\term_reference_tree\Plugin\Field\FieldFormatter\TermReferenceTree::settingsSummary()
- 8 src/Plugin/Field/FieldWidget/TermReferenceTree.php \Drupal\term_reference_tree\Plugin\Field\FieldWidget\TermReferenceTree::settingsSummary()
Returns a short summary for the current widget settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.
Return value
array A short summary of the widget settings.
Overrides WidgetBase::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ TermReferenceTree.php, line 111
Class
- TermReferenceTree
- Plugin implementation of the 'term_reference_tree' widget.
Namespace
Drupal\term_reference_tree\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = [];
if ($this
->getSetting('start_minimized')) {
$summary[] = $this
->t('Start minimized');
}
if ($this
->getSetting('leaves_only')) {
$summary[] = $this
->t('Leaves only');
}
if ($this
->getSetting('select_parents')) {
$summary[] = $this
->t('Select parents automatically');
}
$cascadingSelection = $this
->getSetting('cascading_selection');
if ($cascadingSelection == self::CASCADING_SELECTION_BOTH) {
$summary[] = $this
->t('Cascading selection');
}
elseif ($cascadingSelection == self::CASCADING_SELECTION_SELECT) {
$summary[] = sprintf('%s (%s)', $this
->t('Cascading selection'), $this
->t('Only select'));
}
elseif ($cascadingSelection == self::CASCADING_SELECTION_DESELECT) {
$summary[] = sprintf('%s (%s)', $this
->t('Cascading selection'), $this
->t('Only deselect'));
}
if ($this
->getSetting('max_depth')) {
$summary[] = $this
->formatPlural($this
->getSetting('max_depth'), 'Maximum Depth: @count level', 'Maximum Depth: @count levels');
}
return $summary;
}