From e4c57fd0bf2abe6623137cf8477003a992ec1952 Mon Sep 17 00:00:00 2001 From: Samuel Mortenson Date: Mon, 26 Oct 2015 10:53:17 -0700 Subject: [PATCH] Issue #2600706 by samuel.mortenson: $instance_uuid not passed to RegisterJSCallbacks::__construct() in built in Displays. --- src/Entity/EntityBrowser.php | 1 + src/Plugin/EntityBrowser/Display/IFrame.php | 3 ++- src/Plugin/EntityBrowser/Display/Modal.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Entity/EntityBrowser.php b/src/Entity/EntityBrowser.php index 88bda9e..1381ef9 100644 --- a/src/Entity/EntityBrowser.php +++ b/src/Entity/EntityBrowser.php @@ -188,6 +188,7 @@ public function getDisplay() { */ protected function displayPluginCollection() { if (!$this->displayCollection) { + $this->display_configuration['instance_uuid'] = $this->uuid(); $this->display_configuration['entity_browser_id'] = $this->id(); $this->displayCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.entity_browser.display'), $this->display, $this->display_configuration); } diff --git a/src/Plugin/EntityBrowser/Display/IFrame.php b/src/Plugin/EntityBrowser/Display/IFrame.php index 8db37ee..67c00b6 100644 --- a/src/Plugin/EntityBrowser/Display/IFrame.php +++ b/src/Plugin/EntityBrowser/Display/IFrame.php @@ -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 [ diff --git a/src/Plugin/EntityBrowser/Display/Modal.php b/src/Plugin/EntityBrowser/Display/Modal.php index 92f4545..c5446a0 100644 --- a/src/Plugin/EntityBrowser/Display/Modal.php +++ b/src/Plugin/EntityBrowser/Display/Modal.php @@ -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 [