You are here

public function InlineEntityFormBase::settingsSummary in Inline Entity Form 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

1 call to InlineEntityFormBase::settingsSummary()
InlineEntityFormComplex::settingsSummary in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Returns a short summary for the current widget settings.
1 method overrides InlineEntityFormBase::settingsSummary()
InlineEntityFormComplex::settingsSummary in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Returns a short summary for the current widget settings.

File

src/Plugin/Field/FieldWidget/InlineEntityFormBase.php, line 293

Class

InlineEntityFormBase
Inline entity form widget base class.

Namespace

Drupal\inline_entity_form\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  if ($entity_form_mode = $this
    ->getEntityFormMode()) {
    $form_mode_label = $entity_form_mode
      ->label();
  }
  else {
    $form_mode_label = $this
      ->t('Default');
  }
  $summary[] = $this
    ->t('Form mode: @mode', [
    '@mode' => $form_mode_label,
  ]);
  if ($this
    ->getSetting('override_labels')) {
    $summary[] = $this
      ->t('Overriden labels are used: %singular and %plural', [
      '%singular' => $this
        ->getSetting('label_singular'),
      '%plural' => $this
        ->getSetting('label_plural'),
    ]);
  }
  else {
    $summary[] = $this
      ->t('Default labels are used.');
  }
  if ($this
    ->getSetting('revision')) {
    $summary[] = $this
      ->t('Create new revision');
  }
  if ($this
    ->getSetting('collapsible')) {
    $summary[] = $this
      ->t($this
      ->getSetting('collapsed') ? 'Collapsible, collapsed by default' : 'Collapsible');
  }
  return $summary;
}