You are here

class DomainRegistrationPattern in Restrict Domain Registration 8

Sets the _admin_route for specific group-related routes.

Hierarchy

Expanded class hierarchy of DomainRegistrationPattern

1 string reference to 'DomainRegistrationPattern'
domain_registration.services.yml in ./domain_registration.services.yml
domain_registration.services.yml
1 service uses DomainRegistrationPattern
domain_registration.pattern in ./domain_registration.services.yml
Drupal\domain_registration\DomainRegistrationPattern

File

src/DomainRegistrationPattern.php, line 10

Namespace

Drupal\domain_registration
View source
class DomainRegistrationPattern implements DomainRegistrationPatternInterface {

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

  /**
   * Constructs a new DomainRegistrationPattern object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function getPatterns() {
    if ($domains = $this->configFactory
      ->get('domain_registration.settings')
      ->get('pattern')) {
      $domains = explode("\r\n", $domains);
    }
    return $domains ?: [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DomainRegistrationPattern::$configFactory protected property The config factory.
DomainRegistrationPattern::getPatterns public function Returns an array of domain patterns based on the configuration. Overrides DomainRegistrationPatternInterface::getPatterns
DomainRegistrationPattern::__construct public function Constructs a new DomainRegistrationPattern object.