You are here

public function BlazyEntityBase::getScopedFormElements in Blazy 8

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

Defines the scope for the form elements.

2 calls to BlazyEntityBase::getScopedFormElements()
BlazyEntityBase::settingsForm in src/Dejavu/BlazyEntityBase.php
Returns a form to configure settings for the formatter.
BlazyEntityReferenceBase::getScopedFormElements in src/Dejavu/BlazyEntityReferenceBase.php
Defines the scope for the form elements.
1 method overrides BlazyEntityBase::getScopedFormElements()
BlazyEntityReferenceBase::getScopedFormElements in src/Dejavu/BlazyEntityReferenceBase.php
Defines the scope for the form elements.

File

src/Dejavu/BlazyEntityBase.php, line 74

Class

BlazyEntityBase
Base class for entity reference formatters without field details.

Namespace

Drupal\blazy\Dejavu

Code

public function getScopedFormElements() {
  $field = $this->fieldDefinition;
  $entity_type = $field
    ->getTargetEntityTypeId();
  $target_type = $this
    ->getFieldSetting('target_type');
  $views_ui = $this
    ->getFieldSetting('handler') == 'default';
  $bundles = $views_ui ? [] : $this
    ->getFieldSetting('handler_settings')['target_bundles'];
  return [
    'current_view_mode' => $this->viewMode,
    'entity_type' => $entity_type,
    'field_type' => $field
      ->getType(),
    'field_name' => $field
      ->getName(),
    'plugin_id' => $this
      ->getPluginId(),
    'settings' => $this
      ->getSettings(),
    'target_bundles' => $bundles,
    'target_type' => $target_type,
    'view_mode' => $this->viewMode,
  ];
}