<?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,
),
);
$items['theme_test_render_element'] = array(
'render element' => 'elements',
'template' => 'theme-test-render-element',
);
$items['theme_test_render_element_children'] = array(
'render element' => 'element',
);
return $items;
}
function theme_test_system_theme_info() {
$themes['test_theme'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme/test_theme.info.yml';
$themes['test_basetheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_basetheme/test_basetheme.info.yml';
$themes['test_subtheme'] = drupal_get_path('module', 'system') . '/tests/themes/test_subtheme/test_subtheme.info.yml';
$themes['test_theme_phptemplate'] = drupal_get_path('module', 'system') . '/tests/themes/test_theme_phptemplate/test_theme_phptemplate.info.yml';
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/request-listener'] = array(
'page callback' => 'theme_test_request_listener_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,
);
$items['theme-test/info/stylesheets'] = array(
'page callback' => 'theme_test_info_stylesheets',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
function _theme_test_load_registry() {
print 'registry initialized';
return array();
}
function theme_test_request_listener_page_callback() {
return $GLOBALS['theme_test_output'];
}
function theme_test_template_test_page_callback() {
return theme('theme_test_template_test');
}
function theme_test_info_stylesheets() {
$path = drupal_get_path('module', 'theme_test');
drupal_add_css("{$path}/css/base-override.css");
drupal_add_css("{$path}/css/base-override.sub-remove.css");
drupal_add_css("{$path}/css/base-remove.css");
drupal_add_css("{$path}/css/base-remove.sub-override.css");
drupal_add_css("{$path}/css/sub-override.css");
drupal_add_css("{$path}/css/sub-remove.css");
return '';
}
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'];
}
function template_preprocess_theme_test_render_element(&$variables) {
$variables['attributes']['data-variables-are-preprocessed'] = TRUE;
}
function theme_theme_test_render_element_children($variables) {
return drupal_render($variables['element']);
}