You are here

public function DomainSourceCommands::domainSourceDomainDelete in Domain Access 8

@hook on-event domain-delete

File

domain_source/src/Commands/DomainSourceCommands.php, line 60

Class

DomainSourceCommands
Drush commands for the domain source module.

Namespace

Drupal\domain_source\Commands

Code

public function domainSourceDomainDelete($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' => DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD,
  ];
  return $this
    ->doReassign($target_domain, $delete_options);
}