function EntityReferenceAutocompleteWidget::settingsSummary

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::settingsSummary()
  2. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::settingsSummary()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget::settingsSummary()

Overrides WidgetBase::settingsSummary

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php, line 74

Class

EntityReferenceAutocompleteWidget
Plugin implementation of the 'entity_reference_autocomplete' widget.

Namespace

Drupal\Core\Field\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
    $summary = [];
    $operators = $this->getMatchOperatorOptions();
    $summary[] = $this->t('Autocomplete matching: @match_operator', [
        '@match_operator' => $operators[$this->getSetting('match_operator')],
    ]);
    $size = $this->getSetting('match_limit') ?: $this->t('unlimited');
    $summary[] = $this->t('Autocomplete suggestion list size: @size', [
        '@size' => $size,
    ]);
    $summary[] = $this->t('Textfield size: @size', [
        '@size' => $this->getSetting('size'),
    ]);
    $placeholder = $this->getSetting('placeholder');
    if (!empty($placeholder)) {
        $summary[] = $this->t('Placeholder: @placeholder', [
            '@placeholder' => $placeholder,
        ]);
    }
    else {
        $summary[] = $this->t('No placeholder');
    }
    return $summary;
}

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