class FakeViewModeContext

Same name in other branches
  1. 9 core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php \Drupal\layout_builder_fieldblock_test\ContextProvider\FakeViewModeContext
  2. 10 core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php \Drupal\layout_builder_fieldblock_test\ContextProvider\FakeViewModeContext
  3. 11.x core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php \Drupal\layout_builder_fieldblock_test\ContextProvider\FakeViewModeContext

Provides a global context for view_mode for testing purposes.

@group layout_builder

Hierarchy

Expanded class hierarchy of FakeViewModeContext

1 string reference to 'FakeViewModeContext'
layout_builder_fieldblock_test.services.yml in core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/layout_builder_fieldblock_test.services.yml
core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/layout_builder_fieldblock_test.services.yml
1 service uses FakeViewModeContext
layout_builder_fieldblock_test.fake_view_mode_context in core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/layout_builder_fieldblock_test.services.yml
Drupal\layout_builder_fieldblock_test\ContextProvider\FakeViewModeContext

File

core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php, line 14

Namespace

Drupal\layout_builder_fieldblock_test\ContextProvider
View source
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([]);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
FakeViewModeContext::getAvailableContexts public function Gets all available contexts for the purposes of configuration. Overrides ContextProviderInterface::getAvailableContexts
FakeViewModeContext::getRuntimeContexts public function Gets runtime context values for the given context IDs. Overrides ContextProviderInterface::getRuntimeContexts

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.