Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Component / Plugin / Definition / ContextAwarePluginDefinitionInterface.php
diff --git a/web/core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php b/web/core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php
new file mode 100644 (file)
index 0000000..d1ff953
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+namespace Drupal\Component\Plugin\Definition;
+
+use Drupal\Component\Plugin\Context\ContextDefinitionInterface;
+
+/**
+ * Provides an interface for plugin definitions which use contexts.
+ *
+ * @ingroup Plugin
+ */
+interface ContextAwarePluginDefinitionInterface extends PluginDefinitionInterface {
+
+  /**
+   * Checks if the plugin defines a particular context.
+   *
+   * @param string $name
+   *   The context name.
+   *
+   * @return bool
+   *   TRUE if the plugin defines the given context, otherwise FALSE.
+   */
+  public function hasContextDefinition($name);
+
+  /**
+   * Returns all context definitions for this plugin.
+   *
+   * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[]
+   *   The context definitions.
+   */
+  public function getContextDefinitions();
+
+  /**
+   * Returns a particular context definition for this plugin.
+   *
+   * @param string $name
+   *   The context name.
+   *
+   * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
+   *   The context definition.
+   *
+   * @throws \Drupal\Component\Plugin\Exception\ContextException
+   *   Thrown if the plugin does not define the given context.
+   */
+  public function getContextDefinition($name);
+
+  /**
+   * Adds a context to this plugin definition.
+   *
+   * @param string $name
+   *   The context name.
+   * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $definition
+   *   The context definition.
+   *
+   * @return $this
+   *   The called object.
+   */
+  public function addContextDefinition($name, ContextDefinitionInterface $definition);
+
+  /**
+   * Removes a context definition from this plugin.
+   *
+   * @param string $name
+   *   The context name.
+   *
+   * @return $this
+   *   The called object.
+   */
+  public function removeContextDefinition($name);
+
+}