You are here

public function EntityBundle::summary in Chaos Tool Suite (ctools) 8.3

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

Overrides ConditionInterface::summary

File

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

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