function EntityBundle::summary

Overrides ConditionInterface::summary

File

src/Plugin/Condition/EntityBundle.php, line 123

Class

EntityBundle
Provides a 'Entity Bundle' condition.

Namespace

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