/** * {@inheritdoc} */ public function setContext($name, ComponentContextInterface $context) { // Check that the context passed is an instance of our extended interface. if (!$context instanceof ContextInterface) { throw new ContextException("Passed {$name} context must be an instance of \\Drupal\\Core\\Plugin\\Context\\ContextInterface"); } parent::setContext($name, $context); }