first commit

This commit is contained in:
2024-07-15 12:33:27 +02:00
commit ce50ae282b
22084 changed files with 2623791 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
name: 'Deprecated theme test'
type: theme
description: 'Deprecated test theme.'
# version: VERSION
lifecycle: deprecated
lifecycle_link: 'https://example.com/deprecated'
base theme: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,35 @@
<?php
/**
* @file
* Handles integration of Nyan cat templates because we love kittens.
*/
use Drupal\Component\Utility\Html;
/**
* Implements hook_theme().
*/
function nyan_cat_theme($existing, $type, $theme, $path) {
return drupal_find_theme_templates($existing, '.nyan-cat.html', $path);
}
/**
* Implements hook_extension().
*/
function nyan_cat_extension() {
return '.nyan-cat.html';
}
/**
* Implements hook_render_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 (str_contains($output, '9' . $key)) {
$output = str_replace('9' . $key, Html::escape($variable), $output);
}
}
return $output;
}

View File

@@ -0,0 +1,9 @@
type: theme_engine
name: Nyan cat
# version: VERSION
package: Core
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,10 @@
name: 'Experimental dependency test'
type: theme
description: 'Experimental dependency test theme.'
# version: VERSION
base theme: experimental_theme_test
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Experimental test'
type: theme
description: 'Experimental test theme.'
# version: VERSION
base theme: false
lifecycle: experimental
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,10 @@
name: 'Theme Same Name as Module'
type: theme
description: 'Test theme with the same name as a module.'
base theme: false
# version: VERSION
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,12 @@
name: 'Obsolete theme test'
type: theme
description: 'Obsolete test theme.'
# version: VERSION
lifecycle: obsolete
lifecycle_link: 'https://example.com/obsolete'
base theme: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1 @@
# This file is intentionally left empty

View File

@@ -0,0 +1 @@
<h1>Bar</h1>

View File

@@ -0,0 +1,3 @@
div#sdc-wrapper {
opacity: 0;
}

View File

@@ -0,0 +1,14 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Lib Overrides
status: stable
libraryOverrides:
version: 1
dependencies:
- core/drupal.dialog
css:
component:
another-stylesheet.css: {}
https://drupal.org/fake-dependency/styles.css: {}
js:
lib-overrides.js: { attributes: { defer: true, bar: foo } }
https://drupal.org/fake-dependency/index.min.js: {}

View File

@@ -0,0 +1,4 @@
/* The linter does not allow empty CSS. Let's add anything here. */
div {
display: block;
}

View File

@@ -0,0 +1,7 @@
((document, Drupal) => {
Drupal.behaviors.libOverridesComponent = {
attach() {
// Intentionally left blank. We only need the file to exist.
},
};
})(document, Drupal);

View File

@@ -0,0 +1,11 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Foo
status: experimental
libraryOverrides:
css: {}
js: {}
props:
type: object
properties:
prop1:
type: string

View File

@@ -0,0 +1,20 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Card
status: experimental
props:
type: object
required:
- header
properties:
header:
type: string
title: Header
description: The card header
examples:
- I am a header!
slots:
card_body:
title: Body
description: The contents of the card.
examples:
- <p>Foo is <strong>NOT</strong> bar.</p>

View File

@@ -0,0 +1,23 @@
.component--my-card {
max-width: 500px;
margin: 15px auto;
color: #f1f1f1;
border: 1px solid #141414;
background-color: #252525;
}
.component--my-card__header {
margin: 0;
padding: 12px 24px 5px 24px;
border-bottom: 1px solid #4a4a4a;
font-size: 2.5rem;
font-weight: bold;
}
.component--my-card__body {
padding: 12px 24px 24px 24px;
}
.component--my-card__body .component--my-button {
display: block;
margin: 0 auto;
}

View File

@@ -0,0 +1,8 @@
<div {{ attributes }}>
<h2 class="component--my-card__header">{{ header }}</h2>
<div class="component--my-card__body">
{% block card_body %}
Default contents for a card
{% endblock %}
</div>
</div>

View File

@@ -0,0 +1,12 @@
name: 'SDC test theme'
type: theme
description: 'Test theme for sdc.'
# version: VERSION
base theme: sdc_theme_test_base
enforce_prop_schemas: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,3 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Card Without Schema
status: experimental

View File

@@ -0,0 +1,8 @@
<div {{ attributes }}>
<h2 class="component--my-card-no-schema__header">{{ header }}</h2>
<div class="component--my-card-no-schema__body">
{% block card_body %}
Default contents for a card
{% endblock %}
</div>
</div>

View File

@@ -0,0 +1,12 @@
name: 'SDC test theme'
type: theme
description: 'Test theme for sdc.'
# version: VERSION
base theme: starterkit_theme
enforce_prop_schemas: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,21 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Card
status: experimental
replaces: 'sdc_theme_test:my-card'
props:
type: object
required:
- header
properties:
header:
type: string
title: Header
description: The card header
examples:
- I am a header!
slots:
card_body:
title: Body
description: The contents of the card.
examples:
- <p>Foo is <strong>NOT</strong> bar.</p>

View File

@@ -0,0 +1,23 @@
.component--my-card {
max-width: 500px;
margin: 15px auto;
color: #f1f1f1;
border: 1px solid #141414;
background-color: #252525;
}
.component--my-card__header {
margin: 0;
padding: 12px 24px 5px 24px;
border-bottom: 1px solid #4a4a4a;
font-size: 2.5rem;
font-weight: bold;
}
.component--my-card__body {
padding: 12px 24px 24px 24px;
}
.component--my-card__body .component--my-button {
display: block;
margin: 0 auto;
}

View File

@@ -0,0 +1,8 @@
<div {{ attributes }}>
<h2 class="component--my-card__header">{{ header }}</h2>
<div class="component--my-card--replaced__body">
{% block card_body %}
Default contents for a card
{% endblock %}
</div>
</div>

View File

@@ -0,0 +1,12 @@
name: 'SDC test theme'
type: theme
description: 'Test theme for sdc that enforces schema definitions.'
# version: VERSION
base theme: sdc_theme_test
enforce_prop_schemas: true
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,3 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Card Without Schema
status: experimental

View File

@@ -0,0 +1,8 @@
<div {{ attributes }}>
<h2 class="component--my-card-no-schema__header">{{ header }}</h2>
<div class="component--my-card-no-schema__body">
{% block card_body %}
Default contents for a card
{% endblock %}
</div>
</div>

View File

@@ -0,0 +1,12 @@
name: 'SDC test theme'
type: theme
description: 'Test theme for sdc that enforces schema and provides a schema-less component.'
# version: VERSION
base theme: sdc_theme_test
enforce_prop_schemas: true
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,29 @@
name: 'Theme test base theme'
type: theme
description: 'Test theme which acts as a base theme for other test subthemes.'
# version: VERSION
base theme: false
hidden: true
libraries:
- test_basetheme/global-styling
libraries-override:
core/drupal.dialog:
js:
misc/dialog/dialog.js: false
core/loadjs:
js:
assets/vendor/loadjs/loadjs.min.js: js/loadjs.min.js
theme_test/theme_stylesheets_override_and_remove_test:
css:
base:
css/base-remove.css: false
libraries-extend:
starterkit_theme/base:
- test_basetheme/global-styling
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,8 @@
global-styling:
version: VERSION
css:
base:
base-add.css: {}
base-add.sub-remove.css: {}
samename.css: {}
css/base-libraries-extend.css: {}

View File

@@ -0,0 +1,37 @@
<?php
/**
* @file
* Add hooks for tests to use.
*/
use Drupal\views\Plugin\views\cache\CachePluginBase;
use Drupal\views\ViewExecutable;
/**
* Implements hook_views_pre_render().
*/
function test_basetheme_views_pre_render(ViewExecutable $view) {
// We append the function name to the title for test to check for.
$view->setTitle($view->getTitle() . ":" . __FUNCTION__);
}
/**
* Implements hook_views_post_render().
*/
function test_basetheme_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
// We append the function name to the title for test to check for.
$view->setTitle($view->getTitle() . ":" . __FUNCTION__);
}
/**
* Implements hook_preprocess_HOOK() for theme_test_template_test templates.
*/
function test_basetheme_preprocess_theme_test_template_test(&$variables) {
}
/**
* Implements hook_preprocess_HOOK() for theme_test_function_suggestions theme functions.
*/
function test_basetheme_preprocess_theme_test_function_suggestions(&$variables) {
}

View File

@@ -0,0 +1,4 @@
/**
* @file
* Test CSS asset file for test_ckeditor_stylesheets_drupal_root.theme.
*/

View File

@@ -0,0 +1,14 @@
name: Test Drupal root CKEditor stylesheets
type: theme
description: 'A theme that uses a Drupal root CKEditor stylesheet.'
package: Testing
# version: VERSION
base theme: false
ckeditor5-stylesheets:
- /core/modules/system/tests/themes/test_ckeditor_stylesheets_drupal_root/css/yokotsoko.css
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,14 @@
name: Test external CKEditor stylesheets
type: theme
description: 'A theme that uses an external CKEditor stylesheet.'
# version: VERSION
base theme: false
ckeditor_stylesheets:
- https://fonts.googleapis.com/css?family=Open+Sans
ckeditor5-stylesheets:
- https://fonts.googleapis.com/css?family=Open+Sans
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,14 @@
name: Test protocol-relative CKEditor stylesheets
type: theme
description: 'A theme that uses a protocol-relative CKEditor stylesheet.'
# version: VERSION
base theme: false
ckeditor_stylesheets:
- //fonts.googleapis.com/css?family=Open+Sans
ckeditor5-stylesheets:
- //fonts.googleapis.com/css?family=Open+Sans
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,4 @@
/**
* @file
* Test CSS asset file for test_ckeditor_stylesheets_relative.theme.
*/

View File

@@ -0,0 +1,14 @@
name: Test relative CKEditor stylesheets
type: theme
description: 'A theme that uses a relative CKEditor stylesheet.'
# version: VERSION
base theme: false
ckeditor_stylesheets:
- css/yokotsoko.css
ckeditor5-stylesheets:
- css/yokotsoko.css
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,4 @@
/**
* @file
* Test CSS asset file for test_ckeditor_without_5.theme.
*/

View File

@@ -0,0 +1,14 @@
name: No setting for CKEditor 5 stylesheets
type: theme
description: 'A theme that uses ckeditor_stylesheets without ckeditor5-stylesheets.'
package: Testing
# version: VERSION
base theme: false
ckeditor_stylesheets:
- /core/modules/system/tests/themes/test_ckeditor_stylesheets_without_5/css/yokotsoko.css
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Theme test with semver core version'
type: theme
base theme: stable9
description: 'Test theme which has semver core version.'
# version: VERSION
core_version_requirement: ^8 || ^9 || ^10
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,12 @@
name: 'Test deprecated theme'
type: theme
description: 'Support module for testing deprecated themes.'
# version: VERSION
base theme: false
lifecycle: deprecated
lifecycle_link: 'http://example.com/deprecated_theme'
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,10 @@
name: 'Theme test with invalid base theme'
type: theme
description: 'Test theme which has a non-existent base theme.'
# version: VERSION
base theme: not_real_test_basetheme
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,10 @@
name: 'Theme test with valid base theme but no grandparent base theme'
type: theme
description: 'Test theme which has a non-existent base theme in the base chain.'
# version: VERSION
base theme: test_invalid_basetheme
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Theme test with invalid semver core version'
type: theme
base theme: stable9
description: 'Test theme which has an invalid semver core version.'
# version: VERSION
core_version_requirement: ^7
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Theme test with invalid theme engine'
type: theme
description: 'Test theme which has a non-existent theme engine.'
# version: VERSION
engine: not_real_engine
base theme: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,12 @@
name: 'Theme test with missing content region'
type: theme
base theme: stable9
description: 'Test theme which has a non-existent content region.'
# version: VERSION
regions:
- foo: Foo
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,41 @@
{#
/**
* @file
* Test templates file with extra messages div.
*/
#}
<div data-drupal-messages>
{% block messages %}
{% for type, messages in message_list %}
{%
set classes = [
'messages',
'messages--' ~ type,
]
%}
<div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(classes)|without('role', 'aria-label') }}>
{% if type == 'error' %}
<div role="alert">
{% endif %}
{% if status_headings[type] %}
<h2 class="visually-hidden">{{ status_headings[type] }}</h2>
{% endif %}
{% if messages|length > 1 %}
<ul class="messages__list">
{% for message in messages %}
<li class="messages__item">{{ message }}</li>
{% endfor %}
</ul>
{% else %}
{{ messages|first }}
{% endif %}
{% if type == 'error' %}
</div>
{% endif %}
</div>
{# Remove type specific classes. #}
{% set attributes = attributes.removeClass(classes) %}
{% endfor %}
{% endblock messages %}
</div>
<div data-drupal-messages-other></div>

View File

@@ -0,0 +1,10 @@
name: 'Theme test messages'
type: theme
description: 'Test theme which provides another div for messages.'
# version: VERSION
base theme: starterkit_theme
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,15 @@
name: 'Theme test subsubtheme'
type: theme
description: 'Test theme which uses test_subtheme as the base theme.'
# version: VERSION
base theme: test_subtheme
libraries-override:
test_basetheme/global-styling:
css:
base:
css/sub-sub-last-override.css: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,12 @@
<?php
/**
* @file
* Add hooks for tests to use.
*/
/**
* Implements hook_preprocess_HOOK() for theme_test_template_test templates.
*/
function test_subsubtheme_preprocess_theme_test_template_test(&$variables) {
}

View File

@@ -0,0 +1,24 @@
name: 'Theme test subtheme'
type: theme
description: 'Test theme which uses test_basetheme as the base theme.'
# version: VERSION
base theme: test_basetheme
libraries:
- test_subtheme/global-styling
libraries-override:
theme_test/theme_stylesheets_override_and_remove_test:
css:
base:
css/sub-remove.css: false
test_basetheme/global-styling:
css:
base:
base-add.sub-remove.css: false
libraries-extend:
starterkit_theme/base:
- test_subtheme/global-styling
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,7 @@
global-styling:
version: VERSION
css:
base:
css/sub-add.css: {}
css/samename.css: {}
css/sub-libraries-extend.css: {}

View File

@@ -0,0 +1,34 @@
<?php
/**
* @file
* Add hooks for tests to use.
*/
use Drupal\views\Plugin\views\cache\CachePluginBase;
use Drupal\views\ViewExecutable;
/**
* Implements hook_views_pre_render().
*/
function test_subtheme_views_pre_render(ViewExecutable $view) {
// We append the function name to the title for test to check for.
$view->setTitle($view->getTitle() . ":" . __FUNCTION__);
}
/**
* Implements hook_views_post_render().
*/
function test_subtheme_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
// We append the function name to the title for test to check for.
$view->setTitle($view->getTitle() . ":" . __FUNCTION__);
if ($view->id() == 'test_page_display') {
$output['#rows'][0]['#title'] = t('%total_rows items found.', ['%total_rows' => $view->total_rows]);
}
}
/**
* Implements hook_preprocess_HOOK() for theme_test_template_test templates.
*/
function test_subtheme_preprocess_theme_test_template_test(&$variables) {
}

View File

@@ -0,0 +1,5 @@
/* cspell:ignore subtheming */
/**
* @file
* Test CSS asset file for test_subtheming_ckeditor_stylesheets_without_5.theme.
*/

View File

@@ -0,0 +1,14 @@
name: No setting for CKEditor 5 stylesheets here or subtheme
type: theme
description: 'A theme that uses ckeditor_stylesheets without ckeditor5-stylesheets, nor does its base theme.'
package: Testing
# version: VERSION
base theme: test_ckeditor_stylesheets_without_5
ckeditor_stylesheets:
- /core/modules/system/tests/themes/test_ckeditor_stylesheets_without_5/css/another.css
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,4 @@
/**
* @file
* Test CSS asset file for test_theme.theme.
*/

View File

@@ -0,0 +1,4 @@
/**
* @file
* Test JS asset file for test_theme.theme.
*/

View File

@@ -0,0 +1,4 @@
{#
// node--1.html.twig - Dummy file for finding the template
#}
Node Content Dummy

View File

@@ -0,0 +1,8 @@
<?php
namespace Drupal\test_theme;
/**
* Represents a random class, used to test if themes can provide classes.
*/
class ThemeClass {}

View File

@@ -0,0 +1,13 @@
{#
/**
* @file
* Minimal template to ensure chained property access works with white-listing.
*/
#}
<article{{ attributes }}>
<div>
{{ node.field_term.entity.label }}
</div>
</article>

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Theme hook implementor=theme-test--suggestion.html.twig. Foo={{ foo }}

View File

@@ -0,0 +1,3 @@
{# Output for Theme API test #}
Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_alter().
Hooks: {{ module_hook }} {{ theme_hook }}

View File

@@ -0,0 +1,3 @@
{# Output for Theme API test #}
Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_alter().
Hooks: {{ module_hook }} {{ theme_hook }}

View File

@@ -0,0 +1,4 @@
<div class="suggestion">{{ foo }}</div>
{% if bar %}
<div class="suggestion">{{ bar }}</div>
{% endif %}

View File

@@ -0,0 +1 @@
<div class="suggestion">{{ foo }}</div>

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Template provided by theme is registered by module.

View File

@@ -0,0 +1,5 @@
{# Output for Theme API test #}
Template overridden based on suggestion alter hook determined by the base hook.
<p>Theme hook suggestions:
{{ theme_hook_suggestions|safe_join("<br />") }}</p>

View File

@@ -0,0 +1,5 @@
{# Output for Theme API test #}
Template matching the specific theme call.
<p>Theme hook suggestions:
{{ theme_hook_suggestions|safe_join("<br />") }}</p>

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Template overridden based on suggestion provided by the module declaring the theme hook.

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Template overridden based on new theme suggestion provided by a module via hook_theme_suggestions_HOOK_alter().

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Template overridden based on new theme suggestion provided by the test_theme theme via hook_theme_suggestions_HOOK_alter().

View File

@@ -0,0 +1,2 @@
css_class: {{ css_class }}<br>
attributes: {{- attributes -}}<br>

View File

@@ -0,0 +1,71 @@
# 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.
name: '<strong>Test theme</strong>'
type: theme
description: 'Theme for testing the theme system'
# version: VERSION
base theme: starterkit_theme
logo: images/logo2.svg
libraries:
- test_theme/global-styling
libraries-override:
# Replace an entire library.
core/drupal.collapse: test_theme/collapse
# Remove an entire library.
core/drupal.progress: false
# Replace particular library assets.
starterkit_theme/base:
css:
component:
css/components/button.css: css/my-button.css
css/components/container-inline.css: /themes/my_theme/css/my-container-inline.css
css/components/details.css: /themes/my_theme/css/my-details.css
# Remove particular library assets.
starterkit_theme/dialog:
css:
component:
css/components/dialog.css: false
system/base:
css:
component:
/core/themes/stable9/css/system/components/js.module.css: false
# It works for JS as well.
core/drupal.batch:
js:
misc/batch.js: js/collapse.js
# Use Drupal-relative paths.
core/drupal.dropbutton:
css:
component:
/core/themes/stable9/css/core/dropbutton/dropbutton.css: /themes/my_theme/css/dropbutton.css
# Use stream wrappers.
core/drupal.vertical-tabs:
css:
component:
/core/themes/stable9/css/core/vertical-tabs.css: public://my_css/vertical-tabs.css
# Use a protocol-relative URI.
core/drupal.displace:
js:
misc/displace.js: //my-server/my_theme/js/overridden.js
# Use an absolute URI.
core/drupal.announce:
js:
misc/announce.js: http://example.com/my_theme/js/announce.js
regions:
content: Content
left: Left
right: Right
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,13 @@
global-styling:
version: VERSION
css:
base:
kitten.css: {}
collapse:
version: VERSION
js:
js/collapse.js: { }
css:
base:
css/collapse.css: { }

View File

@@ -0,0 +1,135 @@
<?php
/**
* @file
* Theme to help test the Twig engine.
*/
/**
* Implements THEME_preprocess_twig_theme_test_php_variables().
*/
function test_theme_preprocess_twig_theme_test_php_variables(&$variables) {
$variables['php_values'] = _test_theme_twig_php_values();
}
/**
* Implements hook_element_info_alter().
*/
function test_theme_element_info_alter(&$info) {
// Decrease the default size of textfields.
if (isset($info['textfield']['#size'])) {
$info['textfield']['#size'] = 40;
}
}
/**
* Implements hook_library_info_alter().
*/
function test_theme_library_info_alter(&$libraries, $extension) {
if ($extension === 'test_theme') {
$libraries['kitten']['js']['kittens.js'] = [];
}
}
/**
* 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::moduleHandler->alter('theme_test_alter').
*/
function test_theme_theme_test_alter_alter(&$data) {
$data = 'test_theme_theme_test_alter_alter was invoked';
}
/**
* Implements hook_theme_suggestions_alter().
*/
function test_theme_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) {
\Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
// Theme alter hooks run after module alter hooks, so add this theme
// suggestion to the beginning of the array so that the suggestion added by
// the theme_suggestions_test module can be picked up when that module is
// enabled.
if ($hook == 'theme_test_general_suggestions') {
array_unshift($suggestions, 'theme_test_general_suggestions__' . 'theme_override');
$variables['theme_hook'] = 'test_theme_theme_suggestions_alter';
}
}
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function test_theme_theme_suggestions_theme_test_suggestions_alter(array &$suggestions, array $variables) {
\Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
// Theme alter hooks run after module alter hooks, so add this theme
// suggestion to the beginning of the array so that the suggestion added by
// the theme_suggestions_test module can be picked up when that module is
// enabled.
array_unshift($suggestions, 'theme_test_suggestions__' . 'theme_override');
}
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function test_theme_theme_suggestions_node_alter(array &$suggestions, array $variables) {
// Add an invalid suggestion to be tested.
$suggestions[] = 'invalid_theme_suggestions';
\Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
}
/**
* Implements hook_theme_registry_alter().
*/
function test_theme_theme_registry_alter(&$registry) {
$registry['theme_test_template_test']['variables']['additional'] = 'value';
}
/**
* Tests a theme overriding a default hook with a suggestion.
*
* Implements hook_preprocess_HOOK().
*/
function test_theme_preprocess_theme_test_preprocess_suggestions(&$variables) {
$variables['foo'] = 'Theme hook implementor=test_theme_preprocess_theme_test_preprocess_suggestions().';
}
/**
* Tests a theme overriding a default hook with a suggestion.
*/
function test_theme_preprocess_theme_test_preprocess_suggestions__suggestion(&$variables) {
$variables['foo'] = 'Suggestion';
}
/**
* Tests a theme overriding a default hook with a suggestion.
*/
function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$variables) {
$variables['foo'] = 'Kitten';
}
/**
* Tests a theme overriding a default hook with a suggestion.
*/
function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamingo(&$variables) {
$variables['bar'] = 'Flamingo';
}
/**
* Tests a preprocess function with suggestions.
*/
function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose(&$variables) {
$variables['bar'] = 'Moose';
}
/**
* Tests that a class can be loaded within a .theme file.
*/
function test_theme_preprocess_theme_test_theme_class(&$variables) {
if (class_exists('\Drupal\test_theme\ThemeClass')) {
$variables['message'] = 'Loading ThemeClass was successful.';
}
else {
$variables['message'] = 'Loading ThemeClass failed.';
}
}

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Success: Template overrides theme function.

View File

@@ -0,0 +1,2 @@
{# Output for Theme API test #}
Success: Template overridden.

View File

@@ -0,0 +1,9 @@
name: Test Module Theme Depends on with Compatible Constraint
type: module
package: Testing
# version: '8.x-1.2'
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,9 @@
name: Test Module Theme Depends on with Incompatible Constraint
type: module
package: Testing
# version: '8.x-1.8'
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: Test Theme Depending on Version Constrained Modules
type: theme
base theme: stark
dependencies:
- test_module_compatible_constraint (>=8.x-1.x)
- test_module_incompatible_constraint (>=8.x-2.x)
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,9 @@
name: Test Another Module Required by Theme
type: module
package: Testing
# version: VERSION
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,9 @@
name: Test Module Required by Theme
type: module
package: Testing
# version: VERSION
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,20 @@
<?php
/**
* @file
* This file provides testing functionality for update.php.
*/
use Drupal\Core\Extension\Extension;
/**
* Implements hook_system_info_alter().
*/
function test_module_required_by_theme_system_info_alter(array &$info, Extension $file, $type) {
if ($file->getName() == 'test_theme_depending_on_modules') {
$new_info = \Drupal::state()->get('test_theme_depending_on_modules.system_info_alter');
if ($new_info) {
$info = $new_info + $info;
}
}
}

View File

@@ -0,0 +1,11 @@
name: Test Theme Depending on Modules
type: theme
base theme: stark
dependencies:
- test_module_required_by_theme
- test_another_module_required_by_theme
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,31 @@
<?php
/**
* @file
* Test theme depending on modules post update hooks.
*/
if (\Drupal::state()->get('test_theme_depending_on_modules.post_update')) {
/**
* Install a dependent module.
*/
function test_theme_depending_on_modules_post_update_module_install(&$sandbox = NULL) {
\Drupal::service('module_installer')->install(['test_another_module_required_by_theme']);
return 'Post update message from theme post update function';
}
}
if (\Drupal::state()->get('test_theme_depending_on_modules.removed_post_updates')) {
/**
* Implements HOOK_removed_post_updates().
*/
function test_theme_depending_on_modules_removed_post_updates() {
return [
'test_theme_depending_on_modules_post_update_foo' => '3.1',
];
}
}

View File

@@ -0,0 +1,11 @@
name: Test Theme Depending on Nonexisting Module
type: theme
base theme: stark
# version: VERSION
dependencies:
- test_module_non_existing
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,9 @@
type: theme
base theme: stable9
name: 'Test theme with a too long name'
# version: VERSION
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Test theme libraries empty'
type: theme
description: 'Test theme with empty libraries in theme.info.yml'
# version: VERSION
base theme: starterkit_theme
libraries:
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,19 @@
name: 'Test theme libraries-extend'
type: theme
description: 'Test Theme with libraries-extend'
# version: VERSION
base theme: starterkit_theme
libraries-extend:
starterkit_theme/test-navigation:
- test_theme_libraries_extend/extend_one
- test_theme_libraries_extend/extend_two
core/drupal.dialog:
- test_theme_libraries_extend/non_existent_library
test_theme/collapse:
- not_a_string:
expected: 'an exception'
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
extend_one:
css:
theme:
css/extend_1.css: { }
js:
js/extend_1.js: { }
extend_two:
css:
theme:
css/extend_2.css: { }

View File

@@ -0,0 +1,16 @@
name: 'Test theme libraries-override'
type: theme
description: 'Theme with drupalSettings libraries-override'
# version: VERSION
base theme: starterkit_theme
libraries-override:
# drupalSettings libraries override. Should throw a
# \Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException.
core/drupal.ajax:
drupalSettings:
ajaxPageState: { }
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,15 @@
name: 'Test theme libraries-override'
type: theme
description: 'Theme with invalid libraries-override asset spec.'
# version: VERSION
base theme: starterkit_theme
libraries-override:
# A malformed library asset name. Should throw a
# \Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException.
core/drupal.dialog:
css: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,10 @@
name: Test Theme with a Module Dependency and Base Theme with a Different Module Dependency
type: theme
base theme: test_theme_depending_on_modules
dependencies:
- help
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,11 @@
name: 'Test theme for Nyan Cat engine'
type: theme
description: 'Theme for testing the theme system with the Nyan Cat theme engine'
# version: VERSION
engine: nyan_cat
base theme: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,13 @@
<?php
/**
* @file
* Test theme.
*/
/**
* Implements hook_preprocess_theme_test_template_test().
*/
function test_theme_nyan_cat_engine_preprocess_theme_test_template_test(&$variables) {
$variables['kittens'] = 'All of them';
}

View File

@@ -0,0 +1 @@
Success: Template overridden with Nyan Cat theme. 9kittens

View File

@@ -0,0 +1,10 @@
name: 'Theme test theme-settings.php'
type: theme
description: 'Test theme that extends theme settings options via theme-settings.php file'
# version: VERSION
base theme: false
# Information added by Drupal.org packaging script on 2024-07-04
version: '10.3.1'
project: 'drupal'
datestamp: 1720094222

View File

@@ -0,0 +1,50 @@
<?php
/**
* @file
* Test to ensure theme compatibility with managed files.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\file\Entity\File;
/**
* Implements hook_form_system_theme_settings_alter().
*/
function test_theme_settings_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
$form['custom_logo'] = [
'#type' => 'managed_file',
'#title' => t('Secondary logo.'),
'#default_value' => theme_get_setting('custom_logo'),
'#progress_indicator' => 'bar',
'#progress_message' => t('Processing...'),
'#upload_location' => 'public://test',
'#upload_validators' => [
'FileExtension' => ['extensions' => 'gif png jpg jpeg'],
],
];
$form['multi_file'] = [
'#type' => 'managed_file',
'#title' => t('Multiple file field with all file extensions'),
'#multiple' => TRUE,
'#default_value' => theme_get_setting('multi_file'),
'#upload_location' => 'public://test',
'#upload_validators' => [
'FileExtension' => [],
],
];
$form['#submit'][] = 'test_theme_settings_form_system_theme_settings_submit';
}
/**
* Test theme form settings submission handler.
*/
function test_theme_settings_form_system_theme_settings_submit(&$form, FormStateInterface $form_state) {
if ($file_id = $form_state->getValue(['custom_logo', '0'])) {
$file = File::load($file_id);
$file->setPermanent();
$file->save();
}
}

Some files were not shown because too many files have changed in this diff Show More