You are here

public function PbfFieldWidget::settingsSummary in Permissions by field 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 EntityReferenceAutocompleteWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/PbfFieldWidget.php, line 183

Class

PbfFieldWidget
Plugin implementation of the 'pbf_field_widget' widget.

Namespace

Drupal\pbf\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = array();
  $operators = $this
    ->getMatchOperatorOptions();
  $summary[] = t('Autocomplete matching: @match_operator', array(
    '@match_operator' => $operators[$this
      ->getSetting('match_operator')],
  ));
  $summary[] = t('Textfield size: @size', array(
    '@size' => $this
      ->getSetting('size'),
  ));
  $placeholder = $this
    ->getSetting('placeholder');
  if (!empty($placeholder)) {
    $summary[] = t('Placeholder: @placeholder', array(
      '@placeholder' => $placeholder,
    ));
  }
  else {
    $summary[] = t('No placeholder');
  }
  if ($this
    ->getSetting('grant_global')) {
    $summary[] = t('Grants access set generally. Grant access used are :');
  }
  else {
    $summary[] = t('Grants access set on each node. Default grant access are :');
  }
  $summary[] = t('Public:@public, Grant view:@view, Grant update:@update, Grant delete:@delete', [
    '@public' => $this
      ->getSetting('grant_public'),
    '@view' => $this
      ->getSetting('grant_view'),
    '@update' => $this
      ->getSetting('grant_update'),
    '@delete' => $this
      ->getSetting('grant_delete'),
  ]);
  return $summary;
}