You are here

protected function EntityEmbedDialog::loadEntityBrowser in Entity Embed 8

Load the current entity browser and its settings from the form state.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

1 call to EntityEmbedDialog::loadEntityBrowser()
EntityEmbedDialog::buildForm in src/Form/EntityEmbedDialog.php
Form constructor.

File

src/Form/EntityEmbedDialog.php, line 893

Class

EntityEmbedDialog
Provides a form to embed entities by specifying data attributes.

Namespace

Drupal\entity_embed\Form

Code

protected function loadEntityBrowser(FormStateInterface $form_state) {
  $this->entityBrowser = NULL;
  $this->entityBrowserSettings = [];

  /** @var \Drupal\embed\EmbedButtonInterface $embed_button */
  $embed_button = $form_state
    ->get('embed_button');
  if ($embed_button && ($entity_browser_id = $embed_button
    ->getTypePlugin()
    ->getConfigurationValue('entity_browser'))) {
    $this->entityBrowser = $this->entityTypeManager
      ->getStorage('entity_browser')
      ->load($entity_browser_id);
    $this->entityBrowserSettings = $embed_button
      ->getTypePlugin()
      ->getConfigurationValue('entity_browser_settings');
  }
}