You are here

private function EntityBrowserContext::getAllEntityBrowserSettings in Lightning Media 8.2

Same name and namespace in other branches
  1. 8.3 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::getAllEntityBrowserSettings()

Returns settings for all entity browser instances on the page.

Return value

array[] The settings for all entity browser instances, keyed by UUID.

1 call to EntityBrowserContext::getAllEntityBrowserSettings()
EntityBrowserContext::getEntityBrowserSettings in tests/contexts/EntityBrowserContext.behat.inc
Returns settings for a single entity browser.

File

tests/contexts/EntityBrowserContext.behat.inc, line 232

Class

EntityBrowserContext
Contains step definitions for interacting with entity browser instances.

Namespace

Acquia\LightningExtension\Context

Code

private function getAllEntityBrowserSettings() {
  $settings = $this
    ->getAllSettings();
  Assert::isArray($settings['entity_browser']);
  Assert::notEmpty($settings['entity_browser']);
  $display_types = \Drupal::service('plugin.manager.entity_browser.display')
    ->getDefinitions();
  $settings = array_intersect_key($settings['entity_browser'], $display_types);
  $all = [];
  foreach ($settings as $display_type => $instances) {
    foreach ($instances as $uuid => $instance) {
      $instance['display_type'] = $display_type;
      $instance['uuid'] = $uuid;
      $all[$uuid] = $instance;
    }
  }
  return $all;
}