You are here

public function FileBrowserWidget::settingsSummary in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/FileBrowserWidget.php \Drupal\entity_browser\Plugin\Field\FieldWidget\FileBrowserWidget::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 EntityReferenceBrowserWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/FileBrowserWidget.php, line 184

Class

FileBrowserWidget
Entity browser file widget.

Namespace

Drupal\entity_browser\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = $this
    ->summaryBase();
  $view_mode = $this
    ->getSetting('view_mode');
  $image_style_setting = $this
    ->getSetting('preview_image_style');
  if ($this->moduleHandler
    ->moduleExists('file_entity')) {
    $preview_image_style = $this
      ->t('Preview with @view_mode', [
      '@view_mode' => $view_mode,
    ]);
  }
  elseif ($this->fieldDefinition
    ->getType() == 'image' && ($image_style = ImageStyle::load($image_style_setting))) {
    $preview_image_style = $this
      ->t('Preview image style: @style', [
      '@style' => $image_style
        ->label(),
    ]);
  }
  else {
    $preview_image_style = $this
      ->t('No preview image');
  }
  array_unshift($summary, $preview_image_style);
  return $summary;
}