Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContexts().
Overrides ContextAwarePluginInterface::getContexts
public function getContexts() {
$definitions = $this
->getContextDefinitions();
if ($definitions && empty($this->context)) {
throw new PluginException("There are no set contexts.");
}
$contexts = array();
foreach (array_keys($definitions) as $name) {
if (empty($this->context[$name])) {
throw new PluginException("The {$name} context is not yet set.");
}
$contexts[$name] = $this->context[$name];
}
return $contexts;
}