TestStateBasedSectionStorage.php in Drupal 9
File
core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
View source
<?php
namespace Drupal\layout_builder_test\Plugin\SectionStorage;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase;
use Drupal\layout_builder\Section;
use Drupal\layout_builder\SectionComponent;
use Symfony\Component\Routing\RouteCollection;
class TestStateBasedSectionStorage extends SectionStorageBase {
public function getSections() {
$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,
];
}
public function isApplicable(RefinableCacheableDependencyInterface $cacheability) {
$cacheability
->mergeCacheMaxAge(0);
return \Drupal::state()
->get('layout_builder_test_state', FALSE);
}
public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
}
protected function getSectionList() {
}
public function getStorageId() {
}
public function getSectionListFromId($id) {
}
public function buildRoutes(RouteCollection $collection) {
}
public function getRedirectUrl() {
}
public function getLayoutBuilderUrl($rel = 'view') {
}
public function extractIdFromRoute($value, $definition, $name, array $defaults) {
}
public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {
}
public function label() {
}
public function save() {
}
}