You are here

public function ViewWidget::settingsSummary in Entity Reference View Widget 8

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

src/Plugin/Field/FieldWidget/ViewWidget.php, line 93
Contains \Drupal\entity_reference_view_widget\Plugin\Field\FieldWidget\ViewWidget.

Class

ViewWidget
Plugin implementation of the 'entity_reference_view_widget' widget.

Namespace

Drupal\entity_reference_view_widget\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = array();
  $settings = $this
    ->getSettings();
  if (!empty($settings['view'])) {
    $summary[] = t('View: @view', array(
      '@view' => $settings['view'],
    ));
  }
  else {
    $summary[] = t('No view configured');
  }
  $summary[] = t('Pass selected entity ids to View: @pass_argument', array(
    '@pass_argument' => $settings['pass_argument'] ? t('Yes') : t('No'),
  ));
  $summary[] = t('Close modal window after submitting the items: @close_modal', array(
    '@close_modal' => $settings['close_modal'] ? t('Yes') : t('No'),
  ));
  $summary[] = t('Allow the same entity to be referenced multiple times: @allow_duplicates', array(
    '@allow_duplicates' => $settings['allow_duplicates'] ? t('Yes') : t('No'),
  ));
  return $summary;
}