You are here

public function FileMatcher::getSummary in Linkit 8.5

Same name and namespace in other branches
  1. 8.4 src/Plugin/Linkit/Matcher/FileMatcher.php \Drupal\linkit\Plugin\Linkit\Matcher\FileMatcher::getSummary()

Returns the summarized configuration of the matcher.

Return value

array An array of summarized configuration of the matcher.

Overrides EntityMatcher::getSummary

File

src/Plugin/Linkit/Matcher/FileMatcher.php, line 25

Class

FileMatcher
Provides specific linkit matchers for the file entity type.

Namespace

Drupal\linkit\Plugin\Linkit\Matcher

Code

public function getSummary() {
  $summary = parent::getSummary();
  if (!empty($this->configuration['file_extensions'])) {
    $summary[] = $this
      ->t('Limit matches to the following file extensions: @file_extensions', [
      '@file_extensions' => str_replace(' ', ', ', $this->configuration['file_extensions']),
    ]);
  }
  $summary[] = $this
    ->t('Show image dimensions: @show_image_dimensions', [
    '@show_image_dimensions' => $this->configuration['images']['show_dimensions'] ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  $summary[] = $this
    ->t('Show image thumbnail: @show_image_thumbnail', [
    '@show_image_thumbnail' => $this->configuration['images']['show_thumbnail'] ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($this->moduleHandler
    ->moduleExists('image') && $this->configuration['images']['show_thumbnail']) {
    $image_style = ImageStyle::load($this->configuration['images']['thumbnail_image_style']);
    if (!is_null($image_style)) {
      $summary[] = $this
        ->t('Thumbnail style: @thumbnail_style', [
        '@thumbnail_style' => $image_style
          ->label(),
      ]);
    }
  }
  return $summary;
}