You are here

public function DemoContentManager::createInstances in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  2. 8 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  3. 8.2 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  4. 8.3 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  5. 8.4 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  6. 8.5 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  7. 8.6 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  8. 8.7 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  9. 8.8 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  10. 10.0.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  11. 10.1.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()
  12. 10.2.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstances()

Create multiple instances.

Parameters

array $plugin_ids: Identifiers of plugins.

array $configurations: Array with configuration for all plugins.

Return value

array Array with instances of the plugins.

File

modules/custom/social_demo/src/DemoContentManager.php, line 55

Class

DemoContentManager
Class DemoContentManager.

Namespace

Drupal\social_demo

Code

public function createInstances(array $plugin_ids, array $configurations = []) {
  $instances = [];
  foreach ($plugin_ids as $plugin_id) {
    $configuration = isset($configurations[$plugin_id]) ? $configurations[$plugin_id] : [];
    $instances[$plugin_id] = static::createInstance($plugin_id, $configuration);
  }
  return $instances;
}