SimpleTestContext.php in Typed Data API enhancements 8
File
tests/modules/typed_data_global_context_test/src/ContextProvider/SimpleTestContext.php
View source
<?php
namespace Drupal\typed_data_global_context_test\ContextProvider;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\ContextProviderInterface;
class SimpleTestContext implements ContextProviderInterface {
public function getRuntimeContexts(array $unqualified_context_ids) {
$context_definition = new ContextDefinition('string');
$context = new Context($context_definition, 'Dragons are better than unicorns!');
return [
'dragons' => $context,
];
}
public function getAvailableContexts() {
return $this
->getRuntimeContexts([]);
}
}