You are here

public function SubdomainMethod::enterContext in Persistent URL 8

Overrides MethodInterface::enterContext

File

src/Plugin/Purl/Method/SubdomainMethod.php, line 48

Class

SubdomainMethod
Plugin annotation @PurlMethod( id="subdomain", name="Subdomain" )

Namespace

Drupal\purl\Plugin\Purl\Method

Code

public function enterContext($modifier, $path, array &$options) {
  $baseHost = $this
    ->getBaseHost();
  if (!$baseHost) {
    return null;
  }
  $options['absolute'] = true;
  if ($this
    ->hostContainsModifier($modifier, $baseHost)) {
    return null;
  }
  $options['host'] = sprintf('%s.%s', $modifier, $baseHost);
  return $path;
}