IHaveRuntimeContexts.php

Same filename in this branch
  1. 11.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/IHaveRuntimeContexts.php
Same filename and directory in other branches
  1. 9 core/modules/layout_builder/tests/modules/layout_builder_test/src/ContextProvider/IHaveRuntimeContexts.php
  2. 9 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/IHaveRuntimeContexts.php
  3. 10 core/modules/layout_builder/tests/modules/layout_builder_test/src/ContextProvider/IHaveRuntimeContexts.php
  4. 10 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/IHaveRuntimeContexts.php

Namespace

Drupal\layout_builder_test\ContextProvider

File

core/modules/layout_builder/tests/modules/layout_builder_test/src/ContextProvider/IHaveRuntimeContexts.php

View source
<?php

declare (strict_types=1);
namespace Drupal\layout_builder_test\ContextProvider;

use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\ContextProviderInterface;

/**
 * Defines a class for a fake context provider.
 */
class IHaveRuntimeContexts implements ContextProviderInterface {
  
  /**
   * {@inheritdoc}
   */
  public function getRuntimeContexts(array $unqualified_context_ids) {
    return [
      'runtime_contexts' => new Context(new ContextDefinition('string', 'Do you have runtime contexts?'), 'for sure you can'),
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getAvailableContexts() {
    return [
      'runtime_contexts' => new Context(new ContextDefinition('string', 'Do you have runtime contexts?')),
    ];
  }

}

Classes

Title Deprecated Summary
IHaveRuntimeContexts Defines a class for a fake context provider.

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