You are here

class Middleware in Domain Access 8

Middleware for the domain_config_test module.

Hierarchy

  • class \Drupal\domain_config_middleware_test\Middleware implements \Symfony\Component\HttpKernel\HttpKernelInterface

Expanded class hierarchy of Middleware

1 string reference to 'Middleware'
domain_config_middleware_test.services.yml in domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.services.yml
domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.services.yml
1 service uses Middleware
domain_config_test.middleware in domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.services.yml
Drupal\domain_config_middleware_test\Middleware

File

domain_config/tests/modules/domain_config_middleware_test/src/Middleware.php, line 12

Namespace

Drupal\domain_config_middleware_test
View source
class Middleware implements HttpKernelInterface {

  /**
   * The decorated kernel.
   *
   * @var \Symfony\Component\HttpKernel\HttpKernelInterface
   */
  protected $httpKernel;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs a Middleware object.
   *
   * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
   *   The decorated kernel.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The configuration factory.
   */
  public function __construct(HttpKernelInterface $http_kernel, ConfigFactoryInterface $config_factory) {
    $this->httpKernel = $http_kernel;
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {

    // This line should break hooks in our code.
    // @see https://www.drupal.org/node/2896434.
    $config = $this->configFactory
      ->get('domain_config_middleware_test.settings');
    return $this->httpKernel
      ->handle($request, $type, $catch);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Middleware::$configFactory protected property The config factory.
Middleware::$httpKernel protected property The decorated kernel.
Middleware::handle public function Handles a Request to convert it to a Response.
Middleware::__construct public function Constructs a Middleware object.