TestContextAwareLayout.php
Same filename in other branches
Namespace
Drupal\layout_builder_test\Plugin\LayoutFile
-
core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ Layout/ TestContextAwareLayout.php
View source
<?php
namespace Drupal\layout_builder_test\Plugin\Layout;
use Drupal\Core\Layout\Attribute\Layout;
use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Plugin\Context\EntityContextDefinition;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* The TestContextAwareLayout Class.
*/
class TestContextAwareLayout extends LayoutDefault {
/**
* {@inheritdoc}
*/
public function build(array $regions) {
$build = parent::build($regions);
$build['main']['#attributes']['class'][] = 'user--' . $this->getContextValue('user')
->getAccountName();
return $build;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
TestContextAwareLayout | The TestContextAwareLayout Class. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.