protected function ContextDefinition::getDefinitionClass in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Annotation/ContextDefinition.php \Drupal\Core\Annotation\ContextDefinition::getDefinitionClass()
Determines the context definition class to use.
If the annotation specifies a specific context definition class, we use that. Otherwise, we use \Drupal\Core\Plugin\Context\EntityContextDefinition if the data type starts with 'entity:', since it contains specialized logic specific to entities. Otherwise, we fall back to the generic \Drupal\Core\Plugin\Context\ContextDefinition class.
Parameters
array $values: The annotation values.
Return value
string The fully-qualified name of the context definition class.
1 call to ContextDefinition::getDefinitionClass()
- ContextDefinition::__construct in core/
lib/ Drupal/ Core/ Annotation/ ContextDefinition.php - Constructs a new context definition object.
File
- core/
lib/ Drupal/ Core/ Annotation/ ContextDefinition.php, line 144
Class
- ContextDefinition
- Defines a context definition annotation object.
Namespace
Drupal\Core\AnnotationCode
protected function getDefinitionClass(array $values) {
if (isset($values['class'])) {
return $values['class'];
}
if (strpos($values['value'], 'entity:') === 0) {
return 'Drupal\\Core\\Plugin\\Context\\EntityContextDefinition';
}
return 'Drupal\\Core\\Plugin\\Context\\ContextDefinition';
}