You are here

layout.module in Layout 8.2

Same filename and directory in other branches
  1. 7 layout.module

Manages page layouts for content presentation.

File

layout.module
View source
<?php

/**
 * @file
 * Manages page layouts for content presentation.
 */

/**
 * Implements hook_menu().
 */
function layout_menu() {
  $items['admin/structure/templates'] = array(
    'title' => 'Templates',
    'description' => 'Overview of the list of layout templates available.',
    'route_name' => 'layout.list',
  );
  return $items;
}

/**
 * Implements hook_permission().
 */
function layout_permission() {
  return array(
    'administer layouts' => array(
      'title' => t('Administer templates'),
      'description' => t('Access administration functions for templates.'),
    ),
  );
}

/**
 * Implements hook_theme().
 *
 * Expose all layouts as theme items, so themes can override layout markup.
 */
function layout_theme($existing, $type, $theme, $path) {
  $items = array();
  foreach (Drupal::service('plugin.manager.layout')
    ->getDefinitions() as $name => $layout) {
    $items[$layout['theme']] = array(
      'variables' => array(
        'content' => NULL,
      ),
      'path' => $layout['path'],
      'template' => $layout['template'],
    );
  }
  return $items;
}

Functions

Namesort descending Description
layout_menu Implements hook_menu().
layout_permission Implements hook_permission().
layout_theme Implements hook_theme().