function LinkWidget::settingsSummary

Same name in other branches
  1. 9 core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::settingsSummary()
  2. 10 core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::settingsSummary()
  3. 11.x core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::settingsSummary()

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\FieldWidget

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.