class TestStateBasedSectionStorage
Same name in other branches
- 8.9.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\TestStateBasedSectionStorage
- 10 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\TestStateBasedSectionStorage
- 11.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\TestStateBasedSectionStorage
Provides a test section storage that is controlled by state.
Plugin annotation
@SectionStorage(
id = "layout_builder_test_state",
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\layout_builder\SectionStorageInterface, \Drupal\layout_builder\TempStoreIdentifierInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait
- class \Drupal\layout_builder_test\Plugin\SectionStorage\TestStateBasedSectionStorage extends \Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase
- class \Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\layout_builder\SectionStorageInterface, \Drupal\layout_builder\TempStoreIdentifierInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of TestStateBasedSectionStorage
File
-
core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ SectionStorage/ TestStateBasedSectionStorage.php, line 19
Namespace
Drupal\layout_builder_test\Plugin\SectionStorageView source
class TestStateBasedSectionStorage extends SectionStorageBase {
/**
* {@inheritdoc}
*/
public function getSections() {
// Return a custom section.
$section = new Section('layout_onecol');
$section->appendComponent(new SectionComponent('fake-uuid', 'content', [
'id' => 'system_powered_by_block',
'label' => 'Test block title',
'label_display' => 'visible',
]));
return [
$section,
];
}
/**
* {@inheritdoc}
*/
public function isApplicable(RefinableCacheableDependencyInterface $cacheability) {
$cacheability->mergeCacheMaxAge(0);
return \Drupal::state()->get('layout_builder_test_state', FALSE);
}
/**
* {@inheritdoc}
*/
public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
protected function getSectionList() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function getStorageId() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function getSectionListFromId($id) {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function buildRoutes(RouteCollection $collection) {
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function getLayoutBuilderUrl($rel = 'view') {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function extractIdFromRoute($value, $definition, $name, array $defaults) {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function label() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
* {@inheritdoc}
*/
public function save() {
throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.