Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

$instance_uuid not passed to RegisterJSCallbacks::__construct() in built in Displays. #107

Open
wants to merge 1 commit into
base: 8.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Entity/EntityBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public function getDisplay() {
*/
protected function displayPluginCollection() {
if (!$this->displayCollection) {
$this->display_configuration['instance_uuid'] = $this->uuid();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to avoid having any state information for entity browser instances in EntityBrowser class.

$this->display_configuration['entity_browser_id'] = $this->id();
$this->displayCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.entity_browser.display'), $this->display, $this->display_configuration);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/EntityBrowser/Display/IFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public function defaultConfiguration() {
*/
public function displayEntityBrowser() {
/** @var \Drupal\entity_browser\Events\RegisterJSCallbacks $event */
$event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, new RegisterJSCallbacks($this->configuration['entity_browser_id']));
$callback_event = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $this->configuration['instance_uuid']);
$event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $callback_event);
$uuid = $this->getUuid();
$original_path = $this->currentPath->getPath();
return [
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/EntityBrowser/Display/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public function defaultConfiguration() {
*/
public function displayEntityBrowser() {
/** @var \Drupal\entity_browser\Events\RegisterJSCallbacks $event */
$event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, new RegisterJSCallbacks($this->configuration['entity_browser_id']));
$callback_event = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $this->configuration['instance_uuid']);
$event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $callback_event);
$uuid = $this->getUuid();
$original_path = $this->currentPath->getPath();
return [
Expand Down