You are here

public function BlazyEntityReferenceBase::getScopedFormElements in Blazy 8

Same name and namespace in other branches
  1. 8.2 src/Dejavu/BlazyEntityReferenceBase.php \Drupal\blazy\Dejavu\BlazyEntityReferenceBase::getScopedFormElements()

Defines the scope for the form elements.

Overrides BlazyEntityBase::getScopedFormElements

1 call to BlazyEntityReferenceBase::getScopedFormElements()
BlazyTestEntityReferenceFormatterTest::getScopedFormElements in tests/modules/blazy_test/src/Plugin/Field/FieldFormatter/BlazyTestEntityReferenceFormatterTest.php
Defines the scope for the form elements.
1 method overrides BlazyEntityReferenceBase::getScopedFormElements()
BlazyTestEntityReferenceFormatterTest::getScopedFormElements in tests/modules/blazy_test/src/Plugin/Field/FieldFormatter/BlazyTestEntityReferenceFormatterTest.php
Defines the scope for the form elements.

File

src/Dejavu/BlazyEntityReferenceBase.php, line 235

Class

BlazyEntityReferenceBase
Base class for entity reference formatters with field details.

Namespace

Drupal\blazy\Dejavu

Code

public function getScopedFormElements() {
  $admin = $this
    ->admin();
  $target_type = $this
    ->getFieldSetting('target_type');
  $views_ui = $this
    ->getFieldSetting('handler') == 'default';
  $bundles = $views_ui ? [] : $this
    ->getFieldSetting('handler_settings')['target_bundles'];
  $strings = [
    'text',
    'string',
    'list_string',
  ];
  $strings = $admin
    ->getFieldOptions($bundles, $strings, $target_type);
  $texts = [
    'text',
    'text_long',
    'string',
    'string_long',
    'link',
  ];
  $texts = $admin
    ->getFieldOptions($bundles, $texts, $target_type);
  $links = [
    'text',
    'string',
    'link',
  ];
  return [
    'background' => TRUE,
    'box_captions' => TRUE,
    'breakpoints' => BlazyDefault::getConstantBreakpoints(),
    'captions' => $admin
      ->getFieldOptions($bundles, [], $target_type),
    'classes' => $strings,
    'fieldable_form' => TRUE,
    'images' => $admin
      ->getFieldOptions($bundles, [
      'image',
    ], $target_type),
    'image_style_form' => TRUE,
    'layouts' => $strings,
    'links' => $admin
      ->getFieldOptions($bundles, $links, $target_type),
    'media_switch_form' => TRUE,
    'multimedia' => TRUE,
    'thumb_captions' => $texts,
    'thumb_positions' => TRUE,
    'nav' => TRUE,
    'titles' => $texts,
    'vanilla' => TRUE,
  ] + parent::getScopedFormElements();
}