public function LinkIconFormatterTrait::settingsSummary in Link Icon 8
File
- src/
Plugin/ Field/ FieldFormatter/ LinkIconFormatterTrait.php, line 322
Class
- LinkIconFormatterTrait
- A Trait to decluter the main formatter class for readability.
Namespace
Drupal\linkicon\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$settings = $this
->getSettings();
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');
}
$summary[] = $this
->t('Prefix class: <em>@linkicon_prefix</em>.', [
'@linkicon_prefix' => $settings['linkicon_prefix'],
]);
if (isset($settings['linkicon_link'])) {
$summary[] = t('Icon classes at A tag: <em>@linkicon_link</em>.', [
'@linkicon_link' => $settings['linkicon_link'] ? t('Yes') : t('No'),
]);
}
if (isset($settings['linkicon_icon_class'])) {
$summary[] = t('Extra icon classes: <em>@linkicon_icon_class</em>.', [
'@linkicon_icon_class' => $settings['linkicon_icon_class'],
]);
}
$summary[] = $this
->t('Module CSS: <em>@linkicon_load</em>. Wrapper: <em>@linkicon_wrapper_class</em>. Style: <em>@linkicon_style</em>. Bg: <em>@linkicon_color</em>.', [
'@linkicon_load' => $settings['linkicon_load'] ? $this
->t('Yes') : $this
->t('No'),
'@linkicon_wrapper_class' => $settings['linkicon_wrapper_class'] ? $settings['linkicon_wrapper_class'] : $this
->t('None'),
'@linkicon_vertical' => $settings['linkicon_vertical'] ? $this
->t('Vertical') : $this
->t('Horizontal'),
'@linkicon_style' => $settings['linkicon_style'] ? $settings['linkicon_style'] : $this
->t('None'),
'@linkicon_color' => $settings['linkicon_color'] ? $settings['linkicon_color'] : $this
->t('None'),
]);
if ($settings['linkicon_load']) {
$summary[] = $this
->t('Size: <em>@linkicon_size</em>. No text: <em>@linkicon_no_text</em>. Tooltip: <em>@linkicon_tooltip</em>', [
'@linkicon_size' => $settings['linkicon_size'],
'@linkicon_no_text' => $settings['linkicon_no_text'] ? $this
->t('Yes') : $this
->t('No'),
'@linkicon_tooltip' => $settings['linkicon_tooltip'] ? $this
->t('Yes') : $this
->t('No'),
]);
if (empty($settings['linkicon_no_text'])) {
$summary[] = $this
->t('Use global title: <em>@linkicon_global_title</em>. <br>Icon position: <em>@linkicon_position</em>.', [
'@linkicon_global_title' => $settings['linkicon_global_title'] ? $settings['linkicon_global_title'] : $this
->t('No'),
'@linkicon_position' => $settings['linkicon_position'] ? $settings['linkicon_position'] : $this
->t('Left'),
]);
}
}
return $summary;
}