You are here

class FakeViewModeContext in Drupal 8

Same name and namespace 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

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

Namesort descending Modifiers Type Description Overrides
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