function ImageUrlFormatter::settingsSummary

Same name in other branches
  1. 9 core/modules/image/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php \Drupal\image\Plugin\Field\FieldFormatter\ImageUrlFormatter::settingsSummary()
  2. 8.9.x core/modules/image/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php \Drupal\image\Plugin\Field\FieldFormatter\ImageUrlFormatter::settingsSummary()
  3. 11.x core/modules/image/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php \Drupal\image\Plugin\Field\FieldFormatter\ImageUrlFormatter::settingsSummary()

Overrides FormatterBase::settingsSummary

File

core/modules/image/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php, line 127

Class

ImageUrlFormatter
Plugin implementation of the 'image_url' formatter.

Namespace

Drupal\image\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
    $summary = [];
    $image_styles = image_style_options(FALSE);
    // Unset possible 'No defined styles' option.
    unset($image_styles['']);
    // Styles could be lost because of enabled/disabled modules that defines
    // their styles in code.
    $image_style_setting = $this->getSetting('image_style');
    if (isset($image_styles[$image_style_setting])) {
        $summary[] = $this->t('Image style: @style', [
            '@style' => $image_styles[$image_style_setting],
        ]);
    }
    else {
        $summary[] = $this->t('Original image');
    }
    return array_merge($summary, parent::settingsSummary());
}

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