FakeViewModeContext.php in Drupal 9
Same filename and directory in other branches
File
core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.phpView source
<?php
namespace Drupal\layout_builder_fieldblock_test\ContextProvider;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\ContextProviderInterface;
/**
* Provides a global context for view_mode for testing purposes.
*
* @group layout_builder
*/
class FakeViewModeContext implements ContextProviderInterface {
/**
* {@inheritdoc}
*/
public function getRuntimeContexts(array $unqualified_context_ids) {
return [
'view_mode' => new Context(new ContextDefinition('string'), 'default'),
];
}
/**
* {@inheritdoc}
*/
public function getAvailableContexts() {
return $this
->getRuntimeContexts([]);
}
}
Classes
Name | Description |
---|---|
FakeViewModeContext | Provides a global context for view_mode for testing purposes. |