本文整理汇总了PHP中Drupal\Core\Plugin\DefaultPluginManager::createInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DefaultPluginManager::createInstance方法的具体用法?PHP DefaultPluginManager::createInstance怎么用?PHP DefaultPluginManager::createInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Plugin\DefaultPluginManager
的用法示例。
在下文中一共展示了DefaultPluginManager::createInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = [])
{
if (!$this->isPluginSupported($plugin_id)) {
$plugin_id = $this->getFallbackPluginId($plugin_id);
}
return parent::createInstance($plugin_id, $configuration);
}
示例2: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = array())
{
if (!isset($configuration['theme'])) {
$configuration['theme'] = $this->theme;
}
return parent::createInstance($plugin_id, $configuration);
}
示例3: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = [])
{
// If a fully qualified event name is passed, be sure to get the base name
// first.
$plugin_id = $this->getEventBaseName($plugin_id);
return parent::createInstance($plugin_id, $configuration);
}
示例4: createInstance
/**
* Overrides PluginManagerBase::createInstance().
*
* This method is overridden to set the request object when the resource
* object is instantiated.
*/
public function createInstance($plugin_id, array $configuration = array())
{
/* @var ResourceInterface $resource */
$resource = parent::createInstance($plugin_id, $configuration);
$resource->setRequest($this->request);
return $resource;
}
示例5: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = [])
{
$instance = parent::createInstance($plugin_id, $configuration);
// Make sure that the instance has a UUID and generate one if necessary.
if (!$instance->getUuid()) {
$instance->setUuid($this->uuidService->generate());
}
return $instance;
}
示例6: createInstance
/**
* Overrides \Drupal\Component\Plugin\PluginManagerBase::createInstance().
*/
public function createInstance($plugin_id, array $configuration = array())
{
// We want to provide a broken handler class whenever a class is not found.
try {
return parent::createInstance($plugin_id, $configuration);
} catch (PluginException $e) {
return new SelectionBroken($configuration['field_definition']);
}
}
示例7: createInstance
/**
* @param string $plugin_id
* @param array $configuration
*
* @return object
* @throws \Exception
*/
public function createInstance($plugin_id, array $configuration = array()) {
if (empty($configuration['route_name'])) {
// @todo Also check for parameters?
throw new \Exception('Route name is require configuration for GroupCreatorManager');
}
$route_name = $configuration['route_name'];
/** @var \Drupal\Core\Routing\RouteProvider $route_provider */
$route_provider = \Drupal::getContainer()->get('router.route_provider');
$configuration['route'] = new RouteMatch($route_name, $route_provider->getRouteByName($route_name));
unset($configuration['route_name']);
return parent::createInstance($plugin_id, $configuration);
}
示例8: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = array()) {
$instance = parent::createInstance($plugin_id, $configuration);
if ($instance instanceof HandlerBase) {
$instance->setModuleHandler($this->moduleHandler);
$instance->setViewsData($this->viewsData);
}
return $instance;
}
示例9: createInstance
/**
* {@inheritdoc}
*
* @return \Drupal\Core\Queue\QueueWorkerInterface
*/
public function createInstance($plugin_id, array $configuration = [])
{
return parent::createInstance($plugin_id, $configuration);
}
示例10: createInstance
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = array())
{
$configuration += (array) $this->config->get('printable.format')->get($plugin_id);
return parent::createInstance($plugin_id, $configuration);
}