You are here

class DomainSourceServiceProvider in Domain Access 8

Provides services for the domain module that extend core functionality.

Hierarchy

Expanded class hierarchy of DomainSourceServiceProvider

File

domain_source/src/DomainSourceServiceProvider.php, line 11

Namespace

Drupal\domain_source
View source
class DomainSourceServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $definition = $container
      ->getDefinition('redirect_response_subscriber');
    if ($this
      ->getDrupalVersion() > 8) {
      $definition
        ->setClass('Drupal\\domain_source\\EventSubscriber\\DomainSourceRedirectResponseSubscriber');
    }
    else {
      $definition
        ->setClass('Drupal\\domain_source\\EventSubscriber\\DomainSourceRedirectResponseSubscriberD8');
    }
  }

  /**
   * Determines the Drupal version.
   *
   * @return integer
   *  The core numberic version.
   */
  private function getDrupalVersion() {
    return (int) substr(\Drupal::VERSION, 0, 1);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DomainSourceServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter
DomainSourceServiceProvider::getDrupalVersion private function Determines the Drupal version.
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1