-
-
Save timplunkett/80b49d5ba53cdb0593c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Constructs a new context definition object. | |
* | |
* @param array $values | |
* An associative array with the following keys: | |
* - value: The required data type. | |
* - required: (optional) Whether the context definition is required. | |
* - multiple: (optional) Whether the context definition is multivalue. | |
* - label: (optional) The UI label of this context definition. | |
* - description: (optional) The UI description of this context definition. | |
* - class: (optional) A custom ContextDefinitionInterface class. | |
*/ | |
public function __construct(array $values) { | |
$values += array( | |
'required' => TRUE, | |
'multiple' => FALSE, | |
'label' => NULL, | |
'description' => NULL, | |
'class' => 'Drupal\Core\Plugin\Context\ContextDefinition', | |
); | |
$class = $values['class']; | |
$this->definition = new $class($values['value'], $values['required'], $values['multiple'], $values['label'], $values['description']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment