You are here

public function BlazyTestEntityReferenceFormatterTest::getScopedFormElements in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/src/Plugin/Field/FieldFormatter/BlazyTestEntityReferenceFormatterTest.php \Drupal\blazy_test\Plugin\Field\FieldFormatter\BlazyTestEntityReferenceFormatterTest::getScopedFormElements()

Defines the scope for the form elements.

Overrides BlazyEntityReferenceBase::getScopedFormElements

File

tests/modules/blazy_test/src/Plugin/Field/FieldFormatter/BlazyTestEntityReferenceFormatterTest.php, line 137

Class

BlazyTestEntityReferenceFormatterTest
Plugin implementation of the 'Blazy Entity Reference' formatter.

Namespace

Drupal\blazy_test\Plugin\Field\FieldFormatter

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'];
  $node = $admin
    ->getFieldOptions($bundles, [
    'entity_reference',
  ], $target_type, 'node');
  $stages = $admin
    ->getFieldOptions($bundles, [
    'image',
    'video_embed_field',
  ], $target_type);
  return [
    'namespace' => 'blazy_test',
    'images' => $stages,
    'overlays' => $stages + $node,
    'thumbnails' => $stages,
    'optionsets' => [
      'default' => 'Default',
    ],
  ] + parent::getScopedFormElements();
}