function OEmbedFormatter::settingsSummary

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

Overrides FormatterBase::settingsSummary

File

core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php, line 309

Class

OEmbedFormatter
Plugin implementation of the 'oembed' formatter.

Namespace

Drupal\media\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
    $summary = parent::settingsSummary();
    if ($this->getSetting('max_width') && $this->getSetting('max_height')) {
        $summary[] = $this->t('Maximum size: %max_width x %max_height pixels', [
            '%max_width' => $this->getSetting('max_width'),
            '%max_height' => $this->getSetting('max_height'),
        ]);
    }
    elseif ($this->getSetting('max_width')) {
        $summary[] = $this->t('Maximum width: %max_width pixels', [
            '%max_width' => $this->getSetting('max_width'),
        ]);
    }
    elseif ($this->getSetting('max_height')) {
        $summary[] = $this->t('Maximum height: %max_height pixels', [
            '%max_height' => $this->getSetting('max_height'),
        ]);
    }
    $summary[] = $this->t('Loading attribute: @attribute', [
        '@attribute' => $this->getSetting('loading')['attribute'],
    ]);
    return $summary;
}

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