You are here

FakeViewModeContext.php in Drupal 9

File

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

Namesort descending Description
FakeViewModeContext Provides a global context for view_mode for testing purposes.