public function DemoContentManager::createInstance in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.2 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.3 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.4 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.5 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.6 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.7 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 8.8 modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 10.3.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 10.0.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 10.1.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
- 10.2.x modules/custom/social_demo/src/DemoContentManager.php \Drupal\social_demo\DemoContentManager::createInstance()
Creates a pre-configured instance of a plugin.
Parameters
string $plugin_id: The ID of the plugin being instantiated.
array $configuration: An array of configuration relevant to the plugin instance.
Return value
object A fully configured plugin instance.
Throws
\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.
Overrides PluginManagerBase::createInstance
1 call to DemoContentManager::createInstance()
- DemoContentManager::createInstances in modules/
custom/ social_demo/ src/ DemoContentManager.php - Create multiple instances.
File
- modules/
custom/ social_demo/ src/ DemoContentManager.php, line 32
Class
- DemoContentManager
- Class DemoContentManager.
Namespace
Drupal\social_demoCode
public function createInstance($plugin_id, array $configuration = []) {
/** @var \Drupal\social_demo\DemoContentInterface $plugin */
$plugin = parent::createInstance($plugin_id, $configuration);
$definition = $plugin
->getPluginDefinition();
$storage = \Drupal::entityTypeManager()
->getStorage($definition['entity_type']);
$plugin
->setEntityStorage($storage);
return $plugin;
}