You are here

public function BlazyFileFormatterBase::getScopedFormElements in Blazy 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/BlazyFileFormatterBase.php \Drupal\blazy\Plugin\Field\FieldFormatter\BlazyFileFormatterBase::getScopedFormElements()

Defines the scope for the form elements.

2 calls to BlazyFileFormatterBase::getScopedFormElements()
BlazyFileFormatter::getScopedFormElements in src/Plugin/Field/FieldFormatter/BlazyFileFormatter.php
Defines the scope for the form elements.
BlazyFileFormatterBase::settingsForm in src/Plugin/Field/FieldFormatter/BlazyFileFormatterBase.php
Returns a form to configure settings for the formatter.
1 method overrides BlazyFileFormatterBase::getScopedFormElements()
BlazyFileFormatter::getScopedFormElements in src/Plugin/Field/FieldFormatter/BlazyFileFormatter.php
Defines the scope for the form elements.

File

src/Plugin/Field/FieldFormatter/BlazyFileFormatterBase.php, line 89

Class

BlazyFileFormatterBase
Base class for blazy/slick image, and file ER formatters.

Namespace

Drupal\blazy\Plugin\Field\FieldFormatter

Code

public function getScopedFormElements() {
  $field = $this->fieldDefinition;
  $entity_type = $field
    ->getTargetEntityTypeId();
  $target_type = $this
    ->getFieldSetting('target_type');
  $multiple = $field
    ->getFieldStorageDefinition()
    ->isMultiple();
  return [
    'background' => TRUE,
    'box_captions' => TRUE,
    'breakpoints' => BlazyDefault::getConstantBreakpoints(),
    'captions' => [
      'title' => $this
        ->t('Title'),
      'alt' => $this
        ->t('Alt'),
    ],
    'current_view_mode' => $this->viewMode,
    'entity_type' => $entity_type,
    'field_name' => $field
      ->getName(),
    'field_type' => $field
      ->getType(),
    'grid_form' => $multiple,
    'image_style_form' => TRUE,
    'media_switch_form' => TRUE,
    'namespace' => 'blazy',
    'plugin_id' => $this
      ->getPluginId(),
    'settings' => $this
      ->getSettings(),
    'style' => $multiple,
    'target_type' => $target_type,
    'thumbnail_style' => TRUE,
  ];
}