function ContextDefinition::dataTypeMatches
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::dataTypeMatches()
- 8.9.x core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::dataTypeMatches()
- 10 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::dataTypeMatches()
Checks if this definition's data type matches that of the given context.
Parameters
\Drupal\Core\Plugin\Context\ContextInterface $context: The context to test against.
Return value
bool TRUE if the data types match, otherwise FALSE.
1 call to ContextDefinition::dataTypeMatches()
- ContextDefinition::isSatisfiedBy in core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php - Determines if this definition is satisfied by a context object.
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php, line 275
Class
- ContextDefinition
- Defines a class for context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
protected function dataTypeMatches(ContextInterface $context) {
$this_type = $this->getDataType();
$that_type = $context->getContextDefinition()
->getDataType();
return $this_type === 'any' || $this_type === $that_type || str_starts_with($that_type, "{$this_type}:");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.