You are here

public function LayoutTestController::layoutTestPage in Layout 8.2

Displays basic page for layout testing purposes.

Return value

string An HTML string representing the contents of layout_test page.

1 string reference to 'LayoutTestController::layoutTestPage'
layout_test.routing.yml in tests/layout_test/layout_test.routing.yml
tests/layout_test/layout_test.routing.yml

File

tests/layout_test/lib/Drupal/layout_test/Controller/LayoutTestController.php, line 48
Contains \Drupal\layout_test\Controller\LayoutTestController.

Class

LayoutTestController
Controller routines for layout_test routes.

Namespace

Drupal\layout_test\Controller

Code

public function layoutTestPage() {

  // Hack to enable and apply the theme to this page and manually invoke its
  // layout plugin and render it.
  global $theme;
  $theme = 'layout_test_theme';
  theme_enable(array(
    $theme,
  ));
  $display = $this->entityStorageController
    ->load('test_twocol');
  $layout = $display
    ->getLayoutInstance();

  // @todo This tests that the layout can render its regions, but does not test
  //   block rendering: http://drupal.org/node/1812720.
  // Add sample content in the regions that is looked for in the tests.
  $regions = $layout
    ->getRegions();
  foreach ($regions as $region => $info) {
    $regions[$region] = '<h3>' . $info['label'] . '</h3>';
  }
  return $layout
    ->renderLayout(FALSE, $regions);
}