<?php
function theme_test_theme($existing, $type, $theme, $path) {
$items['theme_test'] = array(
'file' => 'theme_test.inc',
'variables' => array(
'foo' => '',
),
);
$items['theme_test_template_test'] = array(
'template' => 'theme_test.template_test',
);
$items['theme_test_template_test_2'] = array(
'template' => 'theme_test.template_test',
);
$items['theme_test_foo'] = array(
'variables' => array(
'foo' => NULL,
),
);
return $items;
}
function theme_test_system_theme_info() {
$themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info';
$themes['test_basetheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_basetheme/test_basetheme.info';
$themes['test_subtheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_subtheme/test_subtheme.info';
$themes['test_theme_twig'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme_twig/test_theme_twig.info';
return $themes;
}
function theme_test_menu() {
$items['theme-test/suggestion'] = array(
'title' => 'Suggestion',
'page callback' => '_theme_test_suggestion',
'access callback' => TRUE,
'theme callback' => '_theme_custom_theme',
'type' => MENU_CALLBACK,
);
$items['theme-test/alter'] = array(
'title' => 'Suggestion',
'page callback' => '_theme_test_alter',
'access callback' => TRUE,
'theme callback' => '_theme_custom_theme',
'type' => MENU_CALLBACK,
);
$items['theme-test/hook-init'] = array(
'page callback' => 'theme_test_hook_init_page_callback',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['theme-test/template-test'] = array(
'page callback' => 'theme_test_template_test_page_callback',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
function theme_test_init() {
if (arg(0) == 'theme-test' && arg(1) == 'hook-init') {
drupal_theme_rebuild();
$GLOBALS['theme_test_output'] = theme('more_link', array(
'url' => 'user',
'title' => 'Themed output generated in hook_init()',
));
}
if (arg(0) == 'user' && arg(1) == 'autocomplete') {
_theme_registry_callback('_theme_test_load_registry', array());
}
}
function _theme_test_load_registry() {
print 'registry initialized';
return array();
}
function theme_test_hook_init_page_callback() {
return $GLOBALS['theme_test_output'];
}
function theme_test_template_test_page_callback() {
return theme('theme_test_template_test');
}
function _theme_custom_theme() {
return 'test_theme';
}
function _theme_test_alter() {
$data = 'foo';
drupal_alter('theme_test_alter', $data);
return "The altered data is {$data}.";
}
function _theme_test_suggestion() {
return theme(array(
'theme_test__suggestion',
'theme_test',
), array());
}
function theme_test_preprocess_html(&$variables) {
$variables['html_attributes']['theme_test_html_attribute'] = 'theme test html attribute value';
$variables['attributes']['theme_test_body_attribute'] = 'theme test body attribute value';
}
function theme_theme_test_foo($variables) {
return $variables['foo'];
}