8.5.x NodeType.php NodeType::summary()
8.0.x NodeType.php NodeType::summary()
8.1.x NodeType.php NodeType::summary()
8.2.x NodeType.php NodeType::summary()
8.3.x NodeType.php NodeType::summary()
8.4.x NodeType.php NodeType::summary()
8.6.x NodeType.php 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 92

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,
  ]);
}