You are here

public function Domain::summary in Domain Access 8

Provides a human readable summary of the condition's configuration.

Overrides ConditionInterface::summary

File

domain/src/Plugin/Condition/Domain.php, line 100

Class

Domain
Provides a 'Domain' condition.

Namespace

Drupal\domain\Plugin\Condition

Code

public function summary() {

  // Use the domain labels. They will be sanitized below.
  $domains = array_intersect_key(\Drupal::entityTypeManager()
    ->getStorage('domain')
    ->loadOptionsList(), $this->configuration['domains']);
  if (count($domains) > 1) {
    $domains = implode(', ', $domains);
  }
  else {
    $domains = reset($domains);
  }
  if ($this
    ->isNegated()) {
    return $this
      ->t('Active domain is not @domains', [
      '@domains' => $domains,
    ]);
  }
  else {
    return $this
      ->t('Active domain is @domains', [
      '@domains' => $domains,
    ]);
  }
}