You are here

class EntityEmbedDialog in Varbase Media 9.0.x

Same name and namespace in other branches
  1. 8.7 modules/entity_browser_generic_embed/src/Form/EntityEmbedDialog.php \Drupal\entity_browser_generic_embed\Form\EntityEmbedDialog
  2. 8.5 modules/entity_browser_generic_embed/src/Form/EntityEmbedDialog.php \Drupal\entity_browser_generic_embed\Form\EntityEmbedDialog
  3. 8.6 modules/entity_browser_generic_embed/src/Form/EntityEmbedDialog.php \Drupal\entity_browser_generic_embed\Form\EntityEmbedDialog

Entity Embed Dialog.

Hierarchy

  • class \Drupal\entity_browser_generic_embed\Form\EntityEmbedDialog extends \Drupal\entity_embed\Form\EntityEmbedDialog

Expanded class hierarchy of EntityEmbedDialog

1 file declares its use of EntityEmbedDialog
RouteSubscriber.php in modules/entity_browser_generic_embed/src/Routing/RouteSubscriber.php

File

modules/entity_browser_generic_embed/src/Form/EntityEmbedDialog.php, line 12

Namespace

Drupal\entity_browser_generic_embed\Form
View source
class EntityEmbedDialog extends BaseEntityEmbedDialog {

  /**
   * {@inheritdoc}
   */
  public function buildEmbedStep(array $form, FormStateInterface $form_state) {
    $entity = $form_state
      ->get('entity');
    $element = $form_state
      ->get('entity_element');
    $input = $form_state
      ->getUserInput();

    // If we're working with an existing embed, $input['editor_object'] will be
    // set, in which case we don't want to change anything (see ::buildForm()).
    // Otherwise, if the entity being embedded is a media item, see if its type
    // plugin has a preference regarding which display plugin to use.
    if (empty($input['editor_object']) && $entity instanceof MediaInterface) {
      $plugin_definition = $entity
        ->getSource()
        ->getPluginDefinition();
      if (isset($plugin_definition['entity_embed_display'])) {
        $element['data-entity-embed-display'] = $plugin_definition['entity_embed_display'];
        $form_state
          ->set('entity_element', $element);
      }
    }
    $form = parent::buildEmbedStep($form, $form_state);
    return $form;
  }

}

Members