You are here

protected function FileVideoFormatter::prepareAttributes in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\FileVideoFormatter::prepareAttributes()
  2. 9 core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\FileVideoFormatter::prepareAttributes()

Prepare the attributes according to the settings.

Parameters

string[] $additional_attributes: Additional attributes to be applied to the HTML element. Attribute names will be used as key and value in the HTML element.

Return value

\Drupal\Core\Template\Attribute Container with all the attributes for the HTML tag.

Overrides FileMediaFormatterBase::prepareAttributes

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php, line 88

Class

FileVideoFormatter
Plugin implementation of the 'file_video' formatter.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

protected function prepareAttributes(array $additional_attributes = []) {
  return parent::prepareAttributes([
    'muted',
  ])
    ->setAttribute('width', $this
    ->getSetting('width'))
    ->setAttribute('height', $this
    ->getSetting('height'));
}