You are here

public function LinkWidget::settingsSummary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 312
Contains \Drupal\link\Plugin\Field\FieldWidget\LinkWidget.

Class

LinkWidget
Plugin implementation of the 'link' widget.

Namespace

Drupal\link\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = array();
  $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', array(
        '@placeholder_title' => $placeholder_title,
      ));
    }
    if (!empty($placeholder_url)) {
      $summary[] = $this
        ->t('URL placeholder: @placeholder_url', array(
        '@placeholder_url' => $placeholder_url,
      ));
    }
  }
  return $summary;
}