public function LinkWidget::settingsSummary in Drupal 8
Same name and namespace in other branches
- 9 core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::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
- core/
modules/ link/ src/ Plugin/ Field/ FieldWidget/ LinkWidget.php, line 378
Class
- LinkWidget
- Plugin implementation of the 'link' widget.
Namespace
Drupal\link\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = [];
$placeholder_title = $this
->getSetting('placeholder_title');
$placeholder_url = $this
->getSetting('placeholder_url');
if (empty($placeholder_title) && empty($placeholder_url)) {
$summary[] = $this
->t('No placeholders');
}
else {
if (!empty($placeholder_title)) {
$summary[] = $this
->t('Title placeholder: @placeholder_title', [
'@placeholder_title' => $placeholder_title,
]);
}
if (!empty($placeholder_url)) {
$summary[] = $this
->t('URL placeholder: @placeholder_url', [
'@placeholder_url' => $placeholder_url,
]);
}
}
return $summary;
}