function layout_page_view

Page callback: Demonstrates a layout template.

Parameters

string $key: The key of the page layout being requested.

Return value

array An array as expected by drupal_render().

See also

layout_menu()

1 string reference to 'layout_page_view'
layout_menu in drupal/core/modules/layout/layout.module
Implements hook_menu().

File

drupal/core/modules/layout/layout.admin.inc, line 59
Administration functions for layouts.

Code

function layout_page_view($key) {
  $layout = layout_manager()
    ->getDefinition($key);
  drupal_set_title(t('View template %name', array(
    '%name' => $layout['title'],
  )), PASS_THROUGH);

  // Render the layout in an admin context with region demonstrations.
  $instance = layout_manager()
    ->createInstance($key, array());
  $regions = $instance
    ->getRegions();
  foreach ($regions as $region => $info) {
    $regions[$region] = '<div class="layout-region-demonstration">' . check_plain($info['label']) . '</div>';
  }
  $build['demonstration'] = array(
    '#type' => 'markup',
    '#markup' => $instance
      ->renderLayout(TRUE, $regions),
  );
  $build['#attached']['css'][] = drupal_get_path('module', 'layout') . '/layout.admin.css';
  return $build;
}