You are here

protected function DomainCommands::filterDomains in Domain Access 8

Filters a list of domains by specific exclude list.

Parameters

\Drupal\domain\DomainInterface[] $domains: List of domains.

string[] $exclude: List of domain id to exclude from the list.

\Drupal\domain\DomainInterface[] $initial: Initial value of list that will be returned.

Return value

array An array of domains.

1 call to DomainCommands::filterDomains()
DomainCommands::doReassign in domain/src/Commands/DomainCommands.php
Handles reassignment of entities to another domain.

File

domain/src/Commands/DomainCommands.php, line 1032

Class

DomainCommands
Drush commands for the domain module.

Namespace

Drupal\domain\Commands

Code

protected function filterDomains(array $domains, array $exclude, array $initial = []) {
  foreach ($domains as $domain) {

    // Exclude unwanted domains.
    if (!in_array($domain
      ->id(), $exclude, FALSE)) {
      $initial[$domain
        ->id()] = $domain;
    }
  }
  return $initial;
}