function NodeType::summary

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.