class ContextDefinition in Typed Data API enhancements 8
Same name in this branch
- 8 src/Context/ContextDefinition.php \Drupal\typed_data\Context\ContextDefinition
- 8 src/Context/Annotation/ContextDefinition.php \Drupal\typed_data\Context\Annotation\ContextDefinition
Extends the core context definition annotation object for Typed Data.
Ensures context definitions use \Drupal\typed_data\Context\ContextDefinitionInterface.
Hierarchy
- class \Drupal\Component\Annotation\Plugin implements AnnotationInterface
- class \Drupal\Core\Annotation\ContextDefinition
- class \Drupal\typed_data\Context\Annotation\ContextDefinition
- class \Drupal\Core\Annotation\ContextDefinition
Expanded class hierarchy of ContextDefinition
File
- src/
Context/ Annotation/ ContextDefinition.php, line 19
Namespace
Drupal\typed_data\Context\AnnotationView source
class ContextDefinition extends CoreContextDefinition {
/**
* The ContextDefinitionInterface object.
*
* @var \Drupal\typed_data\Context\ContextDefinitionInterface
*/
protected $definition;
/**
* {@inheritdoc}
*/
public function __construct(array $values) {
// Filter out any @Translation annotation objects.
foreach ($values as $key => $value) {
if ($value instanceof Translation) {
$values[$key] = $value
->get();
}
}
$this->definition = TypedDataContextDefinition::createFromArray($values);
}
/**
* Returns the value of an annotation.
*
* @return \Drupal\typed_data\Context\ContextDefinitionInterface
* Return the Typed Data version of the ContextDefinitionInterface.
*/
public function get() {
return $this->definition;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextDefinition:: |
protected | property |
The ContextDefinitionInterface object. Overrides ContextDefinition:: |
|
ContextDefinition:: |
public | function |
Returns the value of an annotation. Overrides ContextDefinition:: |
|
ContextDefinition:: |
protected | function | Determines the context definition class to use. | |
ContextDefinition:: |
public | function |
Constructs a new context definition object. Overrides ContextDefinition:: |
|
Plugin:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |