You are here

public function EntityField::summary in Entity Field Condition 2.0.x

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

Overrides ConditionInterface::summary

File

src/Plugin/Condition/EntityField.php, line 457

Class

EntityField
Define the entity field condition base class.

Namespace

Drupal\entity_field_condition\Plugin\Condition

Code

public function summary() : ?TranslatableMarkup {
  $entity_field = $this
    ->getEntityFieldName();
  $entity_bundle = $this
    ->getEntityBundleType();
  if (isset($entity_field, $entity_bundle)) {
    $entity_definition = $this
      ->getEntityContextDataEntityDefinition();
    return $this
      ->t('The @entity_type with bundle of @entity_bundle has a condition for @field.', [
      '@entity_type' => $entity_definition
        ->getLabel(),
      '@entity_bundle' => $entity_bundle,
      '@field' => $entity_field,
    ]);
  }
  return NULL;
}