You are here

class EntityEmbedDialog in Lightning Media 8

Same name and namespace in other branches
  1. 8.4 src/Form/EntityEmbedDialog.php \Drupal\lightning_media\Form\EntityEmbedDialog
  2. 8.2 src/Form/EntityEmbedDialog.php \Drupal\lightning_media\Form\EntityEmbedDialog
  3. 8.3 src/Form/EntityEmbedDialog.php \Drupal\lightning_media\Form\EntityEmbedDialog

Hierarchy

Expanded class hierarchy of EntityEmbedDialog

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

File

src/Form/EntityEmbedDialog.php, line 9

Namespace

Drupal\lightning_media\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);

    // If the user can choose the display plugin, allow Lightning Media's
    // settings to override that access.
    $element =& $form['attributes']['data-entity-embed-display'];
    if ($element['#access']) {
      $element['#access'] = $this
        ->config('lightning_media.settings')
        ->get('entity_embed.choose_display');
    }
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EntityEmbedDialog::$entityBrowser protected property The entity browser.
EntityEmbedDialog::$entityBrowserSettings protected property The entity browser settings from the entity embed button.
EntityEmbedDialog::$entityEmbedDisplayManager protected property The entity embed display manager.
EntityEmbedDialog::$entityFieldManager protected property The entity field manager.
EntityEmbedDialog::$entityTypeManager protected property The entity type manager service.
EntityEmbedDialog::$eventDispatcher protected property Event dispatcher service.
EntityEmbedDialog::$formBuilder protected property The form builder.
EntityEmbedDialog::$moduleHandler protected property The module handler service.
EntityEmbedDialog::buildEmbedStep public function Form constructor for the entity embedding step. Overrides EntityEmbedDialog::buildEmbedStep
EntityEmbedDialog::buildForm public function Form constructor. Overrides FormInterface::buildForm
EntityEmbedDialog::buildReviewStep public function Form constructor for the entity review step.
EntityEmbedDialog::buildSelectStep public function Form constructor for the entity selection step.
EntityEmbedDialog::create public static function Instantiates a new instance of this class. Overrides FormBase::create
EntityEmbedDialog::escapeValue public static function Form element validation handler; Escapes the value an element.
EntityEmbedDialog::getDisplayPluginOptions public function Returns the allowed display plugins given an embed button and an entity.
EntityEmbedDialog::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
EntityEmbedDialog::loadEntityBrowser protected function Load the current entity browser and its settings from the form state.
EntityEmbedDialog::loadEntityByAttributes protected function Loads an entity (in the appropriate translation) given HTML attributes.
EntityEmbedDialog::registerJSCallback public function Registers JS callbacks.
EntityEmbedDialog::submitAndShowEmbed public function Submit and show embed step after submit.
EntityEmbedDialog::submitAndShowReview public function Submit and show review step after submit.
EntityEmbedDialog::submitAndShowSelect public function Submit and show select step after submit.
EntityEmbedDialog::submitEmbedStep public function Form submission handler for the entity embedding step.
EntityEmbedDialog::submitForm public function Form submission handler. Overrides FormInterface::submitForm
EntityEmbedDialog::submitSelectStep public function Form submission handler for the entity selection step.
EntityEmbedDialog::submitStep public function Form submission handler to to another step of the form.
EntityEmbedDialog::updatePluginConfigurationForm public function Form submission handler to update the plugin configuration form.
EntityEmbedDialog::validateEmbedStep public function Form validation handler for the entity embedding step.
EntityEmbedDialog::validateForm public function Form validation handler. Overrides FormBase::validateForm
EntityEmbedDialog::validateSelectStep public function Form validation handler for the entity selection step.
EntityEmbedDialog::__construct public function Constructs a EntityEmbedDialog object.
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.