You are here

public function NodeType::summary in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/src/Plugin/Condition/NodeType.php \Drupal\node\Plugin\Condition\NodeType::summary()

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

Overrides ConditionInterface::summary

File

core/modules/node/src/Plugin/Condition/NodeType.php, line 98

Class

NodeType
Provides a 'Node Type' condition.

Namespace

Drupal\node\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 node bundle is @bundles or @last', [
      '@bundles' => $bundles,
      '@last' => $last,
    ]);
  }
  $bundle = reset($this->configuration['bundles']);
  return $this
    ->t('The node bundle is @bundle', [
    '@bundle' => $bundle,
  ]);
}