public function ConfigContextFactory::get

Returns a configuration context object.

Parameters

string $class: (Optional) The name of the configuration class to use. Defaults to Drupal\Core\Config\Context\ConfigContext

Return value

\Drupal\Core\Config\Context\ContextInterface $context (Optional) The configuration context to use.

File

drupal/core/lib/Drupal/Core/Config/Context/ConfigContextFactory.php, line 50
Contains \Drupal\Core\Config\Context\ConfigContextFactory.

Class

ConfigContextFactory
Defines configuration context factory.

Namespace

Drupal\Core\Config\Context

Code

public function get($class = NULL) {
  if (!$class) {
    $class = 'Drupal\\Core\\Config\\Context\\ConfigContext';
  }
  if (class_exists($class)) {
    $context = new $class($this->eventDispatcher);
  }
  else {
    throw new ConfigException(sprintf('Unknown config context class: %s', $class));
  }
  return $context;
}