core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php index 2744f11..f446055 100644 --- a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php +++ b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php @@ -313,7 +313,7 @@ public function getDataDefinition() { } /** - * Checks if this definition's data type matches that of another context. + * Checks if this definition's data type matches that of the given context. * * @param \Drupal\Core\Plugin\Context\ContextInterface $context * The context to test against. @@ -326,6 +326,7 @@ protected function dataTypeMatches(ContextInterface $context) { $that_type = $context->getContextDefinition()->getDataType(); return ( + // 'any' means all data types are supported. $this_type === 'any' || $this_type === $that_type || // Allow a more generic data type like 'entity' to be fulfilled by a more @@ -340,8 +341,6 @@ protected function dataTypeMatches(ContextInterface $context) { */ public function isSatisfiedBy(ContextInterface $context) { $definition = $context->getContextDefinition(); - // If the data types do not match, this context is invalid unless the - // expected data type is any, which means all data types are supported. if (!$this->dataTypeMatches($context)) { return FALSE; }