You are here

public function DisplayBase::displayEntityBrowser in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/DisplayBase.php \Drupal\entity_browser\DisplayBase::displayEntityBrowser()

Displays entity browser.

This is the "entry point" for every non-entity browser code to interact with it. It will take care about displaying entity browser in one way or another.

Parameters

array $element: A form element array containing basic properties for the entity browser element:

  • #eb_parents: The 'parents' space for the field in the form.

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

array $complete_form: The form structure where entity browser is being attached to.

array $persistent_data: (optional) Extra information to send to the Entity Browser Widget. This is needed as the widget may display after a new bootstrap, which would discard the current form state. Arbitrary values can be added and used by widgets, if needed. The expected array keys are "selected_entities" and "validators".

  • Drupal\Core\Entity\EntityInterface[] selected_entities An array of currently selected entities.
  • array validators An associative array mapping EntityBrowserWidgetValidation IDs to an array of options to pass to the plugin's validate method.

Return value

array A render array.

Overrides DisplayInterface::displayEntityBrowser

3 calls to DisplayBase::displayEntityBrowser()
IFrame::displayEntityBrowser in src/Plugin/EntityBrowser/Display/IFrame.php
Displays entity browser.
Modal::displayEntityBrowser in src/Plugin/EntityBrowser/Display/Modal.php
Displays entity browser.
Standalone::displayEntityBrowser in src/Plugin/EntityBrowser/Display/Standalone.php
Displays entity browser.
2 methods override DisplayBase::displayEntityBrowser()
IFrame::displayEntityBrowser in src/Plugin/EntityBrowser/Display/IFrame.php
Displays entity browser.
Standalone::displayEntityBrowser in src/Plugin/EntityBrowser/Display/Standalone.php
Displays entity browser.

File

src/DisplayBase.php, line 164

Class

DisplayBase
Base implementation for display plugins.

Namespace

Drupal\entity_browser

Code

public function displayEntityBrowser(array $element, FormStateInterface $form_state, array &$complete_form, array $persistent_data = []) {

  // Store persistent data so that after being rendered widgets can still
  // have access to contextual information.
  $this->selectionStorage
    ->setWithExpire($this
    ->getUuid(), $persistent_data, Settings::get('entity_browser_expire', 21600));
}