You are here

public function DomainAccessCommands::domainAccessDomainDelete in Domain Access 8

@hook on-event domain-delete

File

domain_access/src/Commands/DomainAccessCommands.php, line 60

Class

DomainAccessCommands
Drush commands for the domain access module.

Namespace

Drupal\domain_access\Commands

Code

public function domainAccessDomainDelete($target_domain, $options) {

  // Run our own deletion routine here.
  if (is_null($options['content-assign'])) {
    $policy_content = 'prompt';
  }
  if (!empty($options['content-assign'])) {
    if (in_array($options['content-assign'], $this->reassignment_policies, TRUE)) {
      $policy_content = $options['content-assign'];
    }
  }
  $delete_options = [
    'entity_filter' => 'node',
    'policy' => $policy_content,
    'field' => DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD,
  ];
  return $this
    ->doReassign($target_domain, $delete_options);
}