public function FixedTextLink::settingsSummary in Fixed text link formatter 8
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 LinkFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ FixedTextLink.php, line 70
Class
- FixedTextLink
- Plugin implementation of the 'link' formatter.
Namespace
Drupal\fixed_text_link_formatter\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$settings = $this
->getSettings();
$summary[] = $this
->t('Link text: @text', [
'@text' => $this
->getLinkText(),
]);
if (!empty($settings['link_class'])) {
$summary[] = $this
->t('Link class: @text', [
'@text' => $this
->getLinkClass(),
]);
}
if (!empty($settings['rel'])) {
$summary[] = $this
->t('Add rel="@rel"', [
'@rel' => $settings['rel'],
]);
}
if (!empty($settings['target'])) {
$summary[] = $this
->t('Open link in new window');
}
if ($this
->getSetting('allow_override')) {
$summary[] = $this
->t('Link text can be overridden');
}
return $summary;
}