public static function EntityContextDefinition::fromEntity in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntity()
Creates a context definition from a given entity object.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity from which to derive a context definition.
Return value
static
2 calls to EntityContextDefinition::fromEntity()
- ContextHandlerTest::testApplyContextMapping in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ ContextHandlerTest.php - @covers ::applyContextMapping
- ContextHandlerTest::testApplyContextMappingAlreadyApplied in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ ContextHandlerTest.php - @covers ::applyContextMapping
File
- core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php, line 112
Class
- EntityContextDefinition
- Defines a class to provide entity context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
public static function fromEntity(EntityInterface $entity) {
return static::fromEntityType($entity
->getEntityType());
}