52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
<?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_page_list',
|
|
);
|
|
$items['admin/structure/templates/manage/%'] = array(
|
|
'title' => 'View template',
|
|
'route_name' => 'layout_page_view',
|
|
);
|
|
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;
|
|
}
|