3 namespace Drupal\blazy\Dejavu;
5 use Drupal\Core\Field\FormatterBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Base class for blazy video embed field formatters.
11 abstract class BlazyVideoBase extends FormatterBase {
16 public static function defaultSettings() {
17 return BlazyDefault::extendedSettings();
23 public function settingsForm(array $form, FormStateInterface $form_state) {
25 $definition = $this->getScopedFormElements();
27 $definition['_views'] = isset($form['field_api_classes']);
29 $this->admin()->buildSettingsForm($element, $definition);
30 $element['media_switch']['#options']['media'] = $this->t('Image to iFrame');
36 * Defines the scope for the form elements.
38 public function getScopedFormElements() {
39 $field = $this->fieldDefinition;
40 $entity_type = $field->getTargetEntityTypeId();
41 $target_type = $this->getFieldSetting('target_type');
45 'breakpoints' => BlazyDefault::getConstantBreakpoints(),
46 'current_view_mode' => $this->viewMode,
47 'entity_type' => $entity_type,
48 'field_name' => $this->fieldDefinition->getName(),
49 'image_style_form' => TRUE,
50 'media_switch_form' => TRUE,
52 'settings' => $this->getSettings(),
53 'target_type' => $target_type,
54 'thumb_positions' => TRUE,