function OEmbedFormatter::settingsSummary

Same name and namespace in other branches
  1. 8.9.x core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php \Drupal\media\Plugin\Field\FieldFormatter\OEmbedFormatter::settingsSummary()
  2. 10 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 276

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'),
        ]);
    }
    return $summary;
}

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