function EntityContextDefinition::fromEntity
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntity()
- 10 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntity()
- 11.x 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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.