function EntityContext::fromEntityTypeId
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/EntityContext.php \Drupal\Core\Plugin\Context\EntityContext::fromEntityTypeId()
- 8.9.x core/lib/Drupal/Core/Plugin/Context/EntityContext.php \Drupal\Core\Plugin\Context\EntityContext::fromEntityTypeId()
- 11.x core/lib/Drupal/Core/Plugin/Context/EntityContext.php \Drupal\Core\Plugin\Context\EntityContext::fromEntityTypeId()
Gets a context from an entity type ID.
Parameters
string $entity_type_id: Entity type ID from which a definition will be derived.
string $label: (optional) The label of the context.
Return value
static
3 calls to EntityContext::fromEntityTypeId()
- CurrentUserContext::getRuntimeContexts in core/
modules/ user/ src/ ContextProvider/ CurrentUserContext.php - Gets runtime context values for the given context IDs.
- NodeRouteContext::getAvailableContexts in core/
modules/ node/ src/ ContextProvider/ NodeRouteContext.php - Gets all available contexts for the purposes of configuration.
- TermRouteContext::getAvailableContexts in core/
modules/ taxonomy/ src/ ContextProvider/ TermRouteContext.php - Gets all available contexts for the purposes of configuration.
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContext.php, line 23
Class
- EntityContext
- Class to provide a specific entity context.
Namespace
Drupal\Core\Plugin\ContextCode
public static function fromEntityTypeId($entity_type_id, $label = NULL) {
$entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
return static::fromEntityType($entity_type, $label);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.