public function EntityBundle::summary in Drupal 9
Provides a human readable summary of the condition's configuration.
Overrides ConditionInterface::summary
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ Condition/ EntityBundle.php, line 98
Class
- EntityBundle
- Provides the 'Entity Bundle' condition.
Namespace
Drupal\Core\Entity\Plugin\ConditionCode
public function summary() {
if (count($this->configuration['bundles']) > 1) {
$bundles = $this->configuration['bundles'];
$last = array_pop($bundles);
$bundles = implode(', ', $bundles);
if (empty($this->configuration['negate'])) {
return $this
->t('@bundle_type is @bundles or @last', [
'@bundle_type' => $this->pluginDefinition['label'],
'@bundles' => $bundles,
'@last' => $last,
]);
}
else {
return $this
->t('@bundle_type is not @bundles or @last', [
'@bundle_type' => $this->pluginDefinition['label'],
'@bundles' => $bundles,
'@last' => $last,
]);
}
}
$bundle = reset($this->configuration['bundles']);
if (empty($this->configuration['negate'])) {
return $this
->t('@bundle_type is @bundle', [
'@bundle_type' => $this->pluginDefinition['label'],
'@bundle' => $bundle,
]);
}
else {
return $this
->t('@bundle_type is not @bundle', [
'@bundle_type' => $this->pluginDefinition['label'],
'@bundle' => $bundle,
]);
}
}