You are here

public function NotConditionPluginBase::summary in Block Visibility Conditions 8

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

Overrides ConditionInterface::summary

File

src/Plugin/Condition/NotConditionPluginBase.php, line 135

Class

NotConditionPluginBase
Provides a 'Not {ContentEntityType}'-base condition.

Namespace

Drupal\block_visibility_conditions\Plugin\Condition

Code

public function summary() {
  if (count($this->configuration['bundles']) > 1) {
    $bundles = $this->configuration['bundles'];
    $last = array_pop($bundles);
    $bundles = implode(', ', $bundles);
    return $this
      ->t('The %content_entity_type_label is %bundles or %last.', [
      '%content_entity_type_label' => $this->contentEntityType
        ->getLabel(),
      '%bundles' => $bundles,
      '%last' => $last,
    ]);
  }
  $bundle = reset($this->configuration['bundles']);
  return $this
    ->t('The %content_entity_type_label is %bundle', [
    '%content_entity_type_label' => $this->contentEntityType
      ->getLabel(),
    '%bundle' => $bundle,
  ]);
}