function ContextDefinition::dataTypeMatches
Same name in other branches
- 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()
- 11.x 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 272
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 || strpos($that_type, "{$this_type}:") === 0;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.