function EntityContextDefinition::fromEntityType

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntityType()
  2. 8.9.x core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntityType()
  3. 10 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::fromEntityType()

Creates a context definition from a given entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type from which to derive a context definition.

Return value

static

6 calls to EntityContextDefinition::fromEntityType()
EntityBundle::getDerivativeDefinitions in core/lib/Drupal/Core/Entity/Plugin/Condition/Deriver/EntityBundle.php
Gets the definition of all derivatives of a base plugin.
EntityContext::fromEntityType in core/lib/Drupal/Core/Plugin/Context/EntityContext.php
Gets a context from an entity type.
EntityContextDefinition::fromEntity in core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php
Creates a context definition from a given entity object.
EntityContextDefinition::fromEntityTypeId in core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php
Creates a context definition from a given entity type ID.
EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy in core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
Provides test data for ::testIsSatisfiedBy().

... See full list

File

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

Class

EntityContextDefinition
Defines a class to provide entity context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

public static function fromEntityType(EntityTypeInterface $entity_type) {
    return new static('entity:' . $entity_type->id(), $entity_type->getLabel());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.