You are here

public function ConditionCreatorManager::createInstance in Block Visibility Groups 8

Parameters

string $plugin_id:

array $configuration:

Return value

object

Throws

\Exception

Overrides PluginManagerBase::createInstance

File

block_visibility_groups_admin/src/ConditionCreatorManager.php, line 35

Class

ConditionCreatorManager
A Plugin.

Namespace

Drupal\block_visibility_groups_admin

Code

public function createInstance($plugin_id, array $configuration = []) {
  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);
}