You are here

public static function EntityContextDefinition::fromEntityTypeId in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntityTypeId()

Creates a context definition from a given entity type ID.

Parameters

string $entity_type_id: The entity type ID from which to derive a context definition.

Return value

static

2 calls to EntityContextDefinition::fromEntityTypeId()
EntityContextDefinitionIsSatisfiedTest::testIsSatisfiedByPassBundledEntity in core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
@covers ::isSatisfiedBy @covers ::dataTypeMatches @covers ::getSampleValues @covers ::getConstraintObjects
OptionalContextConditionTest::testContextNoValue in core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php
Tests with both contexts mapped to the same user.

File

core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php, line 87

Class

EntityContextDefinition
Defines a class to provide entity context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

public static function fromEntityTypeId($entity_type_id) {
  $entity_type = \Drupal::entityTypeManager()
    ->getDefinition($entity_type_id);
  return static::fromEntityType($entity_type);
}