FakeViewModeContext.php
Same filename in other branches
- 9 core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php
- 8.9.x core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php
- 11.x core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php
Namespace
Drupal\layout_builder_fieldblock_test\ContextProviderFile
-
core/
modules/ layout_builder/ tests/ modules/ layout_builder_fieldblock_test/ src/ ContextProvider/ FakeViewModeContext.php
View 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
Title | Deprecated | Summary |
---|---|---|
FakeViewModeContext | Provides a global context for view_mode for testing purposes. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.