You are here

public function BlazyEntityReferenceBase::getScopedFormElements in Blazy 7

Defines the scope for the form elements.

Overrides BlazyEntityBase::getScopedFormElements

File

src/Plugin/Field/FieldFormatter/BlazyEntityReferenceBase.php, line 206

Class

BlazyEntityReferenceBase
Base class for entity reference formatters with field details.

Namespace

Drupal\blazy\Plugin\Field\FieldFormatter

Code

public function getScopedFormElements() {
  $bundles = $this->fieldDefinition['bundles'];
  $links = [
    'text',
    'link_field',
    'url',
  ];
  $strings = [
    'text',
    'list_text',
  ];
  $texts = [
    'text',
    'text_long',
    'text_with_summary',
    'link_field',
    'url',
  ];
  $this->linkOptions = $this
    ->admin()
    ->getFieldOptions($this->fieldInstance, $links, $this->targetType, $bundles);
  $this->stringOptions = $this
    ->admin()
    ->getFieldOptions($this->fieldInstance, $strings, $this->targetType, $bundles);
  $this->textOptions = $this
    ->admin()
    ->getFieldOptions($this->fieldInstance, $texts, $this->targetType, $bundles);
  return [
    'multimedia' => TRUE,
    'vanilla' => TRUE,
    'captions' => $this
      ->admin()
      ->getFieldOptions($this->fieldInstance, [], $this->targetType, $bundles),
    'classes' => $this->stringOptions,
    'images' => $this
      ->admin()
      ->getFieldOptions($this->fieldInstance, [
      'image',
    ], $this->targetType, $bundles),
    'layouts' => $this->stringOptions,
    'links' => $this->linkOptions,
    'titles' => $this->textOptions,
    'use_view_mode' => TRUE,
  ] + parent::getScopedFormElements();
}