Commit 0d720363 authored by alexpott's avatar alexpott

Issue #2378583 by tim.plunkett, EclipseGc: Core ContextAware Plugins have...

Issue #2378583 by tim.plunkett, EclipseGc: Core ContextAware Plugins have inconsistent ContextDefinition return docs
parent c618fb8b
......@@ -7,9 +7,9 @@
namespace Drupal\Core\Plugin\Context;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Component\Plugin\Exception\ContextException;
use Drupal\Component\Utility\String;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
/**
* Provides methods to handle sets of contexts.
......
......@@ -7,7 +7,7 @@
namespace Drupal\Core\Plugin\Context;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
/**
* Provides an interface for handling sets of contexts.
......@@ -63,7 +63,7 @@ public function getMatchingContexts(array $contexts, ContextDefinitionInterface
/**
* Prepares a plugin for evaluation.
*
* @param \Drupal\Component\Plugin\ContextAwarePluginInterface $plugin
* @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
* A plugin about to be evaluated.
* @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts
* An array of contexts to set on the plugin. They will only be set if they
......
......@@ -7,8 +7,6 @@
namespace Drupal\Core\Plugin;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
/**
* Handles context assignments for context-aware plugins.
*/
......@@ -33,7 +31,7 @@ protected function contextHandler() {
/**
* Builds a form element for assigning a context to a given slot.
*
* @param \Drupal\Component\Plugin\ContextAwarePluginInterface $plugin
* @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
* The context-aware plugin.
* @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts
* An array of contexts.
......
......@@ -20,7 +20,7 @@
/**
* Base class for plugins that are context aware.
*/
abstract class ContextAwarePluginBase extends ComponentContextAwarePluginBase {
abstract class ContextAwarePluginBase extends ComponentContextAwarePluginBase implements ContextAwarePluginInterface {
use TypedDataTrait;
use StringTranslationTrait;
use DependencySerializationTrait;
......
<?php
/**
* @file
* Contains \Drupal\Core\Plugin\ContextAwarePluginInterface.
*/
namespace Drupal\Core\Plugin;
use Drupal\Component\Plugin\ContextAwarePluginInterface as ComponentContextAwarePluginInterface;
/**
* An override of ContextAwarePluginInterface for documentation purposes.
*
* @see \Drupal\Component\Plugin\ContextAwarePluginInterface
*
* @ingroup plugin_api
*/
interface ContextAwarePluginInterface extends ComponentContextAwarePluginInterface {
/**
* Gets the context definitions of the plugin.
*
* @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface[]
* The array of context definitions, keyed by context name.
*/
public function getContextDefinitions();
/**
* Gets a specific context definition of the plugin.
*
* @param string $name
* The name of the context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not defined.
*
* @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface.
* The definition against which the context value must validate.
*/
public function getContextDefinition($name);
}
......@@ -7,7 +7,6 @@
namespace Drupal\block;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Component\Plugin\Exception\ContextException;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Condition\ConditionAccessResolverTrait;
......@@ -17,6 +16,7 @@
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Plugin\Context\ContextHandlerInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......
......@@ -9,13 +9,13 @@
use Drupal\block\Event\BlockContextEvent;
use Drupal\block\Event\BlockEvents;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......
......@@ -7,8 +7,8 @@
namespace Drupal\Tests\block\Unit;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Drupal\Tests\UnitTestCase;
/**
......
......@@ -8,9 +8,9 @@
namespace Drupal\Tests\Core\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\ContextHandler;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Drupal\Tests\UnitTestCase;
/**
......@@ -242,7 +242,7 @@ public function testApplyContextMapping() {
'miss' => $context_miss,
);
$plugin = $this->getMock('Drupal\Component\Plugin\ContextAwarePluginInterface');
$plugin = $this->getMock('Drupal\Core\Plugin\ContextAwarePluginInterface');
$plugin->expects($this->once())
->method('getContextMapping')
->willReturn([]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment