function ContextDefinition::create
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::create()
- 8.9.x core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::create()
- 11.x core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::create()
Creates a new context definition.
Parameters
string $data_type: The data type for which to create the context definition. Defaults to 'any'.
Return value
static The created context definition object.
5 calls to ContextDefinition::create()
- ContextAwarePluginTraitTest::setUp in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Context/ ContextAwarePluginTraitTest.php - ContextDefinitionTest::testCreateWithEntityDataType in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ ContextDefinitionTest.php - @covers ::create
- LayoutBuilderEntityViewDisplay::getContextsForEntity in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php - Gets the available contexts for a given entity.
- NavigationRenderer::buildNavigation in core/
modules/ navigation/ src/ NavigationRenderer.php - Build out the navigation bar.
- OverridesSectionStorageTest::testGetDefaultSectionStorage in core/
modules/ layout_builder/ tests/ src/ Kernel/ OverridesSectionStorageTest.php - @covers ::getDefaultSectionStorage
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php, line 80
Class
- ContextDefinition
- Defines a class for context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
public static function create($data_type = 'any') {
if (str_starts_with($data_type, 'entity:')) {
return new EntityContextDefinition($data_type);
}
return new static($data_type);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.