You are here

public function DomainAliasController::addAlias in Domain Access 8

Provides the domain alias submission form.

Parameters

\Drupal\domain\DomainInterface $domain: An domain record entity.

Return value

array Returns the domain alias submission form.

1 string reference to 'DomainAliasController::addAlias'
domain_alias.routing.yml in domain_alias/domain_alias.routing.yml
domain_alias/domain_alias.routing.yml

File

domain_alias/src/Controller/DomainAliasController.php, line 22

Class

DomainAliasController
Returns responses for Domain Alias module routes.

Namespace

Drupal\domain_alias\Controller

Code

public function addAlias(DomainInterface $domain) {

  // The entire purpose of this controller is to add the values from
  // the parent domain entity.
  $values['domain_id'] = $domain
    ->id();

  // Create the stub alias with reference to the parent domain.
  $alias = $this
    ->entityTypeManager()
    ->getStorage('domain_alias')
    ->create($values);
  return $this
    ->entityFormBuilder()
    ->getForm($alias);
}