Initial commit

This commit is contained in:
Mauricio Dinarte 2024-12-04 10:11:27 -06:00
commit c5e731d8ae
2773 changed files with 600767 additions and 0 deletions

View file

@ -0,0 +1,53 @@
<?php
/**
* @file
* Handles integration of Nyan cat templates because we love kittens.
*/
/**
* Includes .theme file from themes.
*/
function nyan_cat_init($template) {
$file = dirname($template->filename) . '/template.theme';
if (file_exists($file)) {
include_once DRUPAL_ROOT . '/' . $file;
}
}
/**
* Implements hook_theme().
*/
function nyan_cat_theme($existing, $type, $theme, $path) {
$templates = drupal_find_theme_functions($existing, array($theme));
$templates += drupal_find_theme_templates($existing, '.nyan-cat.html', $path);
return $templates;
}
/**
* Implements hook_extension().
*/
function nyan_cat_extension() {
return '.nyan-cat.html';
}
/**
* Implements hook_render_template().
*
* @param string $template_file
* The filename of the template to render.
* @param mixed[] $variables
* A keyed array of variables that will appear in the output.
*
* @return string
* The output generated by the template.
*/
function nyan_cat_render_template($template_file, $variables) {
$output = str_replace('div', 'nyancat', file_get_contents(DRUPAL_ROOT . '/' . $template_file));
foreach ($variables as $key => $variable) {
if (strpos($output, '9' . $key) !== FALSE) {
$output = str_replace('9' . $key, $variable, $output);
}
}
return $output;
}

View file

@ -0,0 +1,12 @@
name = Theme test base theme
description = Test theme which acts as a base theme for other test subthemes.
core = 7.x
hidden = TRUE
settings[basetheme_only] = base theme value
settings[subtheme_override] = base theme value
; Information added by Drupal.org packaging script on 2024-03-06
version = "7.100"
project = "drupal"
datestamp = "1709734591"

View file

@ -0,0 +1,12 @@
name = Theme test subtheme
description = Test theme which uses test_basetheme as the base theme.
core = 7.x
base theme = test_basetheme
hidden = TRUE
settings[subtheme_override] = subtheme value
; Information added by Drupal.org packaging script on 2024-03-06
version = "7.100"
project = "drupal"
datestamp = "1709734591"

View file

@ -0,0 +1,19 @@
<?php
/**
* Tests a theme overriding a suggestion of a base theme hook.
*/
function test_theme_theme_test__suggestion($variables) {
return 'Theme hook implementor=test_theme_theme_test__suggestion(). Foo=' . $variables['foo'];
}
/**
* Tests a theme implementing an alter hook.
*
* The confusing function name here is due to this being an implementation of
* the alter hook invoked when the 'theme_test' module calls
* drupal_alter('theme_test_alter').
*/
function test_theme_theme_test_alter_alter(&$data) {
$data = 'test_theme_theme_test_alter_alter was invoked';
}

View file

@ -0,0 +1,2 @@
<!-- Output for Theme Debug Markup test -->
Node Content Dummy

View file

@ -0,0 +1,23 @@
name = Test theme
description = Theme for testing the theme system
core = 7.x
hidden = TRUE
; Normally, themes may list CSS files like this, and if they exist in the theme
; folder, then they get added to the page. If they have the same file name as a
; module CSS file, then the theme's version overrides the module's version, so
; that the module's version is not added to the page. Additionally, a theme may
; have an entry like this one, without having the corresponding CSS file in the
; theme's folder, and in this case, it just stops the module's version from
; being loaded, and does not replace it with an alternate version. We have this
; here in order for a test to ensure that this correctly prevents the module
; version from being loaded, and that errors aren't caused by the lack of this
; file within the theme folder.
stylesheets[all][] = system.base.css
settings[theme_test_setting] = default value
; Information added by Drupal.org packaging script on 2024-03-06
version = "7.100"
project = "drupal"
datestamp = "1709734591"

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Theme setting callbacks for the test_theme theme.
*/
/**
* Implements hook_form_FORM_ID_alter().
*/
function test_theme_form_system_theme_settings_alter(&$form, &$form_state) {
$form['test_theme_checkbox'] = array(
'#type' => 'checkbox',
'#title' => 'Test theme checkbox',
'#default_value' => theme_get_setting('test_theme_checkbox'),
);
// Force the form to be cached so we can test that this file is properly
// loaded and the custom submit handler is properly called even on a cached
// form build.
$form_state['cache'] = TRUE;
$form['#submit'][] = 'test_theme_form_system_theme_settings_submit';
}
/**
* Form submission handler for the test theme settings form.
*
* @see test_theme_form_system_theme_settings_alter()
*/
function test_theme_form_system_theme_settings_submit($form, &$form_state) {
drupal_set_message('The test theme setting was saved.');
}

View file

@ -0,0 +1,10 @@
name = Nyan cat engine based test theme
description = Theme for testing the module-provided theme engines.
core = 7.x
hidden = TRUE
engine = nyan_cat
; Information added by Drupal.org packaging script on 2024-03-06
version = "7.100"
project = "drupal"
datestamp = "1709734591"