View source
<?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', 'theme_test') . '/themes/test_theme/test_theme.info';
$themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info';
$themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info';
$themes['test_theme_nyan_cat'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme_nyan_cat/test_theme_nyan_cat.info';
return $themes;
}
function theme_test_system_theme_engine_info() {
$theme_engines['nyan_cat'] = drupal_get_path('module', 'theme_test') . '/themes/engines/nyan_cat/nyan_cat.engine';
return $theme_engines;
}
function theme_test_menu() {
$items['theme-test/suggestion'] = array(
'title' => 'Suggestion',
'page callback' => '_theme_test_suggestion',
'access arguments' => array(
'access content',
),
'theme callback' => '_theme_custom_theme',
'type' => MENU_CALLBACK,
);
$items['theme-test/alter'] = array(
'title' => 'Suggestion',
'page callback' => '_theme_test_alter',
'access arguments' => array(
'access content',
),
'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/drupal-add-region-content'] = array(
'page callback' => '_theme_test_drupal_add_region_content',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['theme-test/engine-info-test'] = array(
'description' => "Serves a simple page rendered using a Nyan Cat theme engine template.",
'page callback' => '_theme_test_engine_info_test',
'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()',
));
}
}
function theme_test_exit() {
if (arg(0) == 'user') {
_theme_registry_callback('_theme_test_load_registry', array());
print theme_get_registry() ? 'registry initialized' : 'registry not initialized';
}
}
function _theme_test_load_registry() {
return array();
}
function theme_test_hook_init_page_callback() {
return $GLOBALS['theme_test_output'];
}
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_drupal_add_region_content() {
drupal_add_region_content('content', 'World');
return 'Hello';
}
function _theme_test_engine_info_test() {
return array(
'#markup' => theme('theme_test_template_test'),
);
}
function theme_theme_test_foo($variables) {
return $variables['foo'];
}