Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Drupal\Component\Plugin\Definition; |
Chris@17 | 4 |
Chris@17 | 5 use Drupal\Component\Plugin\Context\ContextDefinitionInterface; |
Chris@17 | 6 |
Chris@17 | 7 /** |
Chris@17 | 8 * Provides an interface for plugin definitions which use contexts. |
Chris@17 | 9 * |
Chris@17 | 10 * @ingroup Plugin |
Chris@17 | 11 */ |
Chris@17 | 12 interface ContextAwarePluginDefinitionInterface extends PluginDefinitionInterface { |
Chris@17 | 13 |
Chris@17 | 14 /** |
Chris@17 | 15 * Checks if the plugin defines a particular context. |
Chris@17 | 16 * |
Chris@17 | 17 * @param string $name |
Chris@17 | 18 * The context name. |
Chris@17 | 19 * |
Chris@17 | 20 * @return bool |
Chris@17 | 21 * TRUE if the plugin defines the given context, otherwise FALSE. |
Chris@17 | 22 */ |
Chris@17 | 23 public function hasContextDefinition($name); |
Chris@17 | 24 |
Chris@17 | 25 /** |
Chris@17 | 26 * Returns all context definitions for this plugin. |
Chris@17 | 27 * |
Chris@17 | 28 * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[] |
Chris@17 | 29 * The context definitions. |
Chris@17 | 30 */ |
Chris@17 | 31 public function getContextDefinitions(); |
Chris@17 | 32 |
Chris@17 | 33 /** |
Chris@17 | 34 * Returns a particular context definition for this plugin. |
Chris@17 | 35 * |
Chris@17 | 36 * @param string $name |
Chris@17 | 37 * The context name. |
Chris@17 | 38 * |
Chris@17 | 39 * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface |
Chris@17 | 40 * The context definition. |
Chris@17 | 41 * |
Chris@17 | 42 * @throws \Drupal\Component\Plugin\Exception\ContextException |
Chris@17 | 43 * Thrown if the plugin does not define the given context. |
Chris@17 | 44 */ |
Chris@17 | 45 public function getContextDefinition($name); |
Chris@17 | 46 |
Chris@17 | 47 /** |
Chris@17 | 48 * Adds a context to this plugin definition. |
Chris@17 | 49 * |
Chris@17 | 50 * @param string $name |
Chris@17 | 51 * The context name. |
Chris@17 | 52 * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $definition |
Chris@17 | 53 * The context definition. |
Chris@17 | 54 * |
Chris@17 | 55 * @return $this |
Chris@17 | 56 * The called object. |
Chris@17 | 57 */ |
Chris@17 | 58 public function addContextDefinition($name, ContextDefinitionInterface $definition); |
Chris@17 | 59 |
Chris@17 | 60 /** |
Chris@17 | 61 * Removes a context definition from this plugin. |
Chris@17 | 62 * |
Chris@17 | 63 * @param string $name |
Chris@17 | 64 * The context name. |
Chris@17 | 65 * |
Chris@17 | 66 * @return $this |
Chris@17 | 67 * The called object. |
Chris@17 | 68 */ |
Chris@17 | 69 public function removeContextDefinition($name); |
Chris@17 | 70 |
Chris@17 | 71 } |