public function FaqFieldDefaultWidget::settingsSummary in FAQ Field 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Field/FieldWidget/FaqFieldDefaultWidget.php \Drupal\faqfield\Plugin\Field\FieldWidget\FaqFieldDefaultWidget::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/ FaqFieldDefaultWidget.php, line 203
Class
- FaqFieldDefaultWidget
- Plugin implementation of the 'faqfield_default' widget.
Namespace
Drupal\faqfield\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = [];
// Answer widget setting.
$answer_widget_options = [
'textarea' => $this
->t('Textarea'),
'text_format' => $this
->t('Formatable textarea'),
'textfield' => $this
->t('Textfield'),
];
$answer_widget = $this
->getSetting('answer_widget');
if (isset($answer_widget_options[$answer_widget])) {
$summary[] = $this
->t('Answer widget : @answer', [
'@answer' => $answer_widget_options[$answer_widget],
]);
}
$summary[] = $this
->t('Answer widget title: @title', [
'@title' => $this
->getSetting('answer_title'),
]);
$summary[] = $this
->t('Question widget title: @title', [
'@title' => $this
->getSetting('question_title'),
]);
return $summary;
}