diff --git a/js/entity_browser.command_queue.js b/js/entity_browser.command_queue.js index 9a62138..48c4287 100644 --- a/js/entity_browser.command_queue.js +++ b/js/entity_browser.command_queue.js @@ -40,9 +40,9 @@ /** * Action to queue command for future execution. * - * @param commandName + * @param {string} commandName * Command name, that will be executed. - * @param commandParam + * @param {Array} commandParam * Params for command. If command already exists in queue params will be * added to end of list. */ @@ -105,4 +105,4 @@ return false; }; -}(jQuery, Drupal)); \ No newline at end of file +}(jQuery, Drupal)); diff --git a/src/Form/EntityBrowserForm.php b/src/Form/EntityBrowserForm.php index 786ce5a..8f3c1e2 100644 --- a/src/Form/EntityBrowserForm.php +++ b/src/Form/EntityBrowserForm.php @@ -112,7 +112,7 @@ class EntityBrowserForm extends FormBase implements EntityBrowserFormInterface { $this->init($form_state); } - $this->isFunctionalForm($form_state); + $this->isFunctionalForm(); $form['#attributes']['class'][] = 'entity-browser-form'; if (!empty($form_state->get(['entity_browser', 'instance_uuid']))) { @@ -149,20 +149,16 @@ class EntityBrowserForm extends FormBase implements EntityBrowserFormInterface { /** * Check if entity browser with selected configuration combination can work. - * - * @param \Drupal\Core\Form\FormStateInterface $form_state - * Form status. */ - protected function isFunctionalForm(FormStateInterface $form_state) { + protected function isFunctionalForm() { /** @var \Drupal\entity_browser\WidgetInterface $widget */ - $widget = $this->entityBrowser->getWidgets() - ->get($this->getCurrentWidget($form_state)); + foreach ($this->entityBrowser->getWidgets() as $widget) { + /** @var \Drupal\entity_browser\SelectionDisplayInterface $selectionDisplay */ + $selectionDisplay = $this->entityBrowser->getSelectionDisplay(); - /** @var \Drupal\entity_browser\SelectionDisplayInterface $selectionDisplay */ - $selectionDisplay = $this->entityBrowser->getSelectionDisplay(); - - if ($widget->requiresJsCommands() && !$selectionDisplay->supportsJsCommands()) { - throw new ConfigException('Used entity browser selection display cannot work in combination with settings defined for used selection widget.'); + if ($widget->requiresJsCommands() && !$selectionDisplay->supportsJsCommands()) { + throw new ConfigException('Used entity browser selection display cannot work in combination with settings defined for used selection widget.'); + } } } diff --git a/tests/src/FunctionalJavascript/EntityBrowserJavascriptTestBase.php b/tests/src/FunctionalJavascript/EntityBrowserJavascriptTestBase.php index d0f71e9..568a595 100644 --- a/tests/src/FunctionalJavascript/EntityBrowserJavascriptTestBase.php +++ b/tests/src/FunctionalJavascript/EntityBrowserJavascriptTestBase.php @@ -3,14 +3,11 @@ namespace Drupal\Tests\entity_browser\FunctionalJavascript; use Drupal\Component\Utility\NestedArray; -use Drupal\Component\Utility\SafeMarkup; -use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\file\Entity\File; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\FunctionalJavascriptTests\JavascriptTestBase; -use Drupal\Tests\Component\Utility\SafeMarkupTest; /** * Base class for Entity browser Javascript functional tests. @@ -115,7 +112,7 @@ abstract class EntityBrowserJavascriptTestBase extends JavascriptTestBase { * @return \Drupal\entity_browser\EntityBrowserInterface * Returns an Entity Browser. */ - protected function getEntityBrowser($browser_name, $display_id, $widget_selector_id, $selection_display_id, $display_configuration = [], $widget_selector_configuration = [], $selection_display_configuration = [], $widget_configurations = []) { + protected function getEntityBrowser($browser_name, $display_id, $widget_selector_id, $selection_display_id, array $display_configuration = [], array $widget_selector_configuration = [], array $selection_display_configuration = [], array $widget_configurations = []) { /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ $storage = $this->container->get('entity_type.manager') ->getStorage('entity_browser'); @@ -238,5 +235,4 @@ abstract class EntityBrowserJavascriptTestBase extends JavascriptTestBase { } } - } diff --git a/tests/src/FunctionalJavascript/MultiStepSelectionDisplayTest.php b/tests/src/FunctionalJavascript/MultiStepSelectionDisplayTest.php index 8c0b0d3..bfbd06a 100644 --- a/tests/src/FunctionalJavascript/MultiStepSelectionDisplayTest.php +++ b/tests/src/FunctionalJavascript/MultiStepSelectionDisplayTest.php @@ -66,7 +66,7 @@ class MultiStepSelectionDisplayTest extends EntityBrowserJavascriptTestBase { * @param array $configuration * Configuration that will be used for field form display. */ - protected function changeFieldFormDisplayConfig($configuration) { + protected function changeFieldFormDisplayConfig(array $configuration) { /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ $form_display = $this->container->get('entity_type.manager') ->getStorage('entity_form_display')