Browse Source

Issue #3128263 by chr.fritsch, daniel.bosen: Move thunder_amp theme to d.o.

* feat: move AMP into its own theme

refactor: remove conflict

build: use tag

[TEST_EVERYTHING]

[TEST_EVERYTHING]

* [TEST_EVERYTHING]

* test: add some tests from PR #3044344

* [TEST_EVERYTHING]
tags/3.4.6
Christian Fritsch GitHub 3 months ago
parent
commit
51a8ea4e68
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 54 additions and 1065 deletions
  1. +1
    -8
      composer.json
  2. +2
    -0
      drupal-org.make
  3. +35
    -0
      tests/src/FunctionalJavascript/ModuleIntegrationTest.php
  4. +16
    -0
      tests/src/Traits/ThunderTestTrait.php
  5. +0
    -26
      themes/thunder_amp/README.md
  6. +0
    -29
      themes/thunder_amp/config/optional/core.entity_view_display.media.gallery.amp.yml
  7. +0
    -56
      themes/thunder_amp/config/optional/core.entity_view_display.media.image.amp.yml
  8. +0
    -50
      themes/thunder_amp/config/optional/core.entity_view_display.node.article.amp.yml
  9. +0
    -26
      themes/thunder_amp/config/optional/core.entity_view_display.paragraph.gallery.amp.yml
  10. +0
    -26
      themes/thunder_amp/config/optional/core.entity_view_display.paragraph.image.amp.yml
  11. +0
    -26
      themes/thunder_amp/config/optional/core.entity_view_display.paragraph.video.amp.yml
  12. +0
    -12
      themes/thunder_amp/config/optional/core.entity_view_mode.media.amp.yml
  13. +0
    -12
      themes/thunder_amp/config/optional/core.entity_view_mode.paragraph.amp.yml
  14. +0
    -25
      themes/thunder_amp/logo.svg
  15. BIN
      themes/thunder_amp/screenshot.png
  16. +0
    -477
      themes/thunder_amp/templates/amp-css/amp-custom-styles.html.twig
  17. +0
    -40
      themes/thunder_amp/templates/block/block--system-branding-block.html.twig
  18. +0
    -27
      themes/thunder_amp/templates/field--media--gallery.html.twig
  19. +0
    -66
      themes/thunder_amp/templates/layout/page.html.twig
  20. +0
    -7
      themes/thunder_amp/templates/media--source-oembed--derivative-video--provider-vimeo.html.twig
  21. +0
    -7
      themes/thunder_amp/templates/media--source-oembed--derivative-video--provider-youtube.html.twig
  22. +0
    -7
      themes/thunder_amp/templates/media-type-instagram-post.html.twig
  23. +0
    -9
      themes/thunder_amp/templates/media-type-twitter-tweet.html.twig
  24. +0
    -29
      themes/thunder_amp/templates/misc/status-messages.html.twig
  25. +0
    -12
      themes/thunder_amp/templates/navigation/amp-skip-link.html.twig
  26. +0
    -10
      themes/thunder_amp/templates/paragraph--paragraphs-riddle-marketplace.html.twig
  27. +0
    -10
      themes/thunder_amp/thunder_amp.info.yml
  28. +0
    -68
      themes/thunder_amp/thunder_amp.theme

+ 1
- 8
composer.json View File

@@ -60,9 +60,6 @@
"drupal/diff": {
"Back button for comparison page": "https://www.drupal.org/files/issues/back_button_for-2853193-4.patch"
},
"drupal/amp": {
"Missing schema": "https://www.drupal.org/files/issues/missing_schema_for-2878769-3.patch"
},
"drupal/entity_browser": {
"Provide inline entity form FieldWidgetDisplay": "https://www.drupal.org/files/issues/2019-07-04/2858438_17.patch",
"Re-order + remove broken with the Entity Reference (and File) widget": "https://www.drupal.org/files/issues/2020-03-30/2851580-83.patch"
@@ -82,8 +79,6 @@
"require": {
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6.5",
"drupal/amp": "1.2",
"drupal/amptheme": "^1.1",
"marc1706/fast-image-size": "^1.1.0",
"oomphinc/composer-installers-extender": "^1.1",
"drupal/access_unpublished": "^1.0-alpha8",
@@ -137,6 +132,7 @@
"drupal/slick": "^2.0-rc3",
"drupal/slick_media": "^2.0-alpha2",
"drupal/thunder_admin": "^3.0",
"drupal/thunder_amp": "^1.0-beta2",
"drupal/thunder_fia": "^1.0",
"drupal/token": "^1.0",
"drupal/update_helper": "^1.3",
@@ -170,8 +166,5 @@
"drupal/config_profile": "^1.0",
"mglaman/phpstan-drupal": "~0.12.0",
"phpstan/phpstan-deprecation-rules": "~0.12.0"
},
"conflict": {
"masterminds/html5": "^2.4.0"
}
}

+ 2
- 0
drupal-org.make View File

@@ -119,6 +119,8 @@ projects[thunder_admin][type] = theme
projects[thunder_admin][version] = 3
projects[thunder_fia][type] = module
projects[thunder_fia][version] = 1
projects[thunder_amp][type] = module
projects[thunder_amp][version] = 1
projects[token][type] = module
projects[token][version] = 1
projects[update_helper][type] = module


+ 35
- 0
tests/src/FunctionalJavascript/ModuleIntegrationTest.php View File

@@ -234,6 +234,41 @@ class ModuleIntegrationTest extends ThunderJavascriptTestBase {
$this->getSession()->executeScript('AMPValidationSuccess = false; console.info = function(message) { if (message === "AMP validation successful.") { AMPValidationSuccess = true } }; amp.validator.validateUrlAndLog(document.location.href, document);');
$this->assertJsCondition('AMPValidationSuccess === true', 10000, 'AMP validation successful.');

$this->drupalLogout();
$this->drupalLogin($this->rootUser);

// Verify that the Site branding block is in the header region.
$this->drupalGet('admin/structure/block/list/thunder_amp');
$element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
[
':block' => 'edit-blocks-thunder-amp-branding',
':status' => 'block-enabled',
':region' => 'header',
]
);
$this->assertNotEmpty($element);

// Verify that the Title block is in the content region.
$this->drupalGet('admin/structure/block/list/thunder_amp');
$element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
[
':block' => 'edit-blocks-thunder-amp-page-title',
':status' => 'block-enabled',
':region' => 'content',
]
);
$this->assertNotEmpty($element);

// Verify that the Content block is in the content region.
$this->drupalGet('admin/structure/block/list/thunder_amp');
$element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
[
':block' => 'edit-blocks-thunder-amp-content',
':status' => 'block-enabled',
':region' => 'content',
]
);
$this->assertNotEmpty($element);
}

/**


+ 16
- 0
tests/src/Traits/ThunderTestTrait.php View File

@@ -9,6 +9,7 @@ use Drupal\Core\Database\Database;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Site\Settings;
use Drupal\dblog\Controller\DbLogController;
use Drupal\user\Entity\User;
use Symfony\Component\HttpFoundation\Request;

/**
@@ -48,6 +49,21 @@ trait ThunderTestTrait {
$this->installDefaultThemeFromClassProperty($container);
$this->installModulesFromClassProperty($container);
$this->rebuildAll();
$this->replaceUser1();
}

/**
* Replace User 1 with the user created here.
*/
protected function replaceUser1() {
/** @var \Drupal\user\UserInterface $account */
// @todo: Saving the account before the update is problematic.
// https://www.drupal.org/node/2560237
$account = User::load(1);
$account->setPassword($this->rootUser->pass_raw);
$account->setEmail($this->rootUser->getEmail());
$account->setUsername($this->rootUser->getAccountName());
$account->save();
}

/**


+ 0
- 26
themes/thunder_amp/README.md View File

@@ -1,26 +0,0 @@
# Thunder AMP Subtheme

This Thunder AMP theme includes config and templates to use AMP with the
Thunder distribution.
If you install this theme, two things will happen:
1. During the installation, the directory `config/optional` of this theme will be read
and included in the config. This configures the view modes for article, paragraphs, media and blocks.
2. The thunder profile will automatically configure
the AMP settings (to be found in "Configuration/Content authoring/AMP Configuration")
and set this theme as the AMP theme.

If you already created the view mode AMP for the article, you will have to manually set paragraphs
to `Rendered entity` with the view mode `AMP`.

Please refer to the README at the root of amptheme for full installation
instructions to get your site ready for AMP.

To create your own custom subtheme, refer to the AMP subtheme example.
You can either use `amptheme` as the base and include configs of this theme as you whish,
or set `thunder_amp` as the base, in which case you get all configs set by this theme
and the profile automatically.
In either case, you have to set your subtheme at `/admin/config/content/amp` manually.

Make sure to follow guidelines at https://www.ampproject.org/ on allowed styles
and markup in order to have valid HTML. Please note that CSS and JS added in a
libraries.yml file will not be loaded on AMP-enabled pages.

+ 0
- 29
themes/thunder_amp/config/optional/core.entity_view_display.media.gallery.amp.yml View File

@@ -1,29 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.media.amp
- field.field.media.gallery.field_media_images
- media.type.gallery
enforced:
theme:
- thunder_amp
id: media.gallery.amp
targetEntityType: media
bundle: gallery
mode: amp
content:
field_media_images:
weight: 0
label: hidden
settings:
view_mode: amp
link: false
third_party_settings: { }
type: entity_reference_entity_view
hidden:
created: true
langcode: true
name: true
thumbnail: true
uid: true

+ 0
- 56
themes/thunder_amp/config/optional/core.entity_view_display.media.image.amp.yml View File

@@ -1,56 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.media.amp
- field.field.media.image.field_copyright
- field.field.media.image.field_description
- field.field.media.image.field_expires
- field.field.media.image.field_image
- field.field.media.image.field_source
- field.field.media.image.field_tags
- image.style.media_image_tablet
- media.type.image
module:
- amp
enforced:
module:
- amp
theme:
- thunder_amp
id: media.image.amp
targetEntityType: media
bundle: image
mode: amp
content:
field_copyright:
weight: 1
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
type: string
field_image:
weight: 0
label: hidden
settings:
image_style: media_image_tablet
image_link: ''
amp_layout: responsive
amp_fixed_height: 300
third_party_settings: { }
type: amp_image
hidden:
created: true
field_brands: true
field_channel: true
field_description: true
field_events: true
field_expires: true
field_people: true
field_source: true
field_tags: true
langcode: true
name: true
thumbnail: true
uid: true

+ 0
- 50
themes/thunder_amp/config/optional/core.entity_view_display.node.article.amp.yml View File

@@ -1,50 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.amp
- field.field.node.article.field_channel
- field.field.node.article.field_meta_tags
- field.field.node.article.field_paragraphs
- field.field.node.article.field_seo_title
- field.field.node.article.field_tags
- field.field.node.article.field_teaser_media
- field.field.node.article.field_teaser_text
- node.type.article
module:
- entity_reference_revisions
- user
enforced:
theme:
- thunder_amp
id: node.article.amp
targetEntityType: node
bundle: article
mode: amp
content:
field_paragraphs:
type: entity_reference_revisions_entity_view
weight: 0
label: hidden
settings:
view_mode: amp
link: ''
third_party_settings: { }
field_tags:
type: entity_reference_label
weight: 1
label: hidden
settings:
link: true
third_party_settings: { }
links:
weight: 2
settings: { }
third_party_settings: { }
hidden:
field_channel: true
field_meta_tags: true
field_seo_title: true
field_teaser_media: true
field_teaser_text: true
langcode: true

+ 0
- 26
themes/thunder_amp/config/optional/core.entity_view_display.paragraph.gallery.amp.yml View File

@@ -1,26 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.gallery.field_media
- paragraphs.paragraphs_type.gallery
enforced:
theme:
- thunder_amp
id: paragraph.gallery.amp
targetEntityType: paragraph
bundle: gallery
mode: amp
content:
field_media:
type: entity_reference_entity_view
weight: 0
label: hidden
settings:
view_mode: amp
link: false
third_party_settings: { }
hidden:
created: true
uid: true

+ 0
- 26
themes/thunder_amp/config/optional/core.entity_view_display.paragraph.image.amp.yml View File

@@ -1,26 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.image.field_image
- paragraphs.paragraphs_type.image
enforced:
theme:
- thunder_amp
id: paragraph.image.amp
targetEntityType: paragraph
bundle: image
mode: amp
content:
field_image:
type: entity_reference_entity_view
weight: 0
label: hidden
settings:
view_mode: amp
link: false
third_party_settings: { }
hidden:
created: true
uid: true

+ 0
- 26
themes/thunder_amp/config/optional/core.entity_view_display.paragraph.video.amp.yml View File

@@ -1,26 +0,0 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.paragraph.amp
- field.field.paragraph.video.field_video
- paragraphs.paragraphs_type.video
enforced:
theme:
- thunder_amp
id: paragraph.video.amp
targetEntityType: paragraph
bundle: video
mode: amp
content:
field_video:
type: entity_reference_entity_view
weight: 0
label: hidden
settings:
view_mode: amp
link: false
third_party_settings: { }
hidden:
created: true
uid: true

+ 0
- 12
themes/thunder_amp/config/optional/core.entity_view_mode.media.amp.yml View File

@@ -1,12 +0,0 @@
langcode: en
status: true
dependencies:
module:
- media
enforced:
theme:
- thunder_amp
id: media.amp
label: AMP
targetEntityType: media
cache: true

+ 0
- 12
themes/thunder_amp/config/optional/core.entity_view_mode.paragraph.amp.yml View File

@@ -1,12 +0,0 @@
langcode: en
status: true
dependencies:
module:
- paragraphs
enforced:
theme:
- thunder_amp
id: paragraph.amp
label: AMP
targetEntityType: paragraph
cache: true

+ 0
- 25
themes/thunder_amp/logo.svg View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 124.1 80.5" enable-background="new 0 0 124.1 80.5" xml:space="preserve">
<g>
<path fill="#A2DAF8" d="M87.3,80.3c-20.6,0-30.4-12.3-32.5-17.1c-1.8-4.4-2.8-10-3-17l0,0v-2c0-0.1,0-0.3,0-0.4v-7
c0-3.8-0.3-7-0.9-9.5c-0.6-2.6-1.6-4.6-2.9-6.1c-1.3-1.5-2.9-2.6-4.9-3.2c-1.9-0.6-4.2-0.9-6.8-0.9c-2.6,0-4.9,0.3-6.8,0.9
c-1.9,0.6-3.6,1.7-4.9,3.2c-1.3,1.5-2.3,3.5-2.9,6.1c-0.6,2.6-0.9,5.8-0.9,9.8v39.8c-0.1,0-0.2,0-0.3,0c-3.4,0-6.5-8.3-9.8-8.3
c-3.4,0-7-22.9-10.5-23.5v-8.6c0-8,1-14.5,3.1-19.3c2-4.8,10.4-8.5,13.9-11c3.4-2.5,6.9-6.1,19.9-6.1c20.6,0,30.4,12.3,32.5,17.1
c1.8,4.4,2.8,10,3,17l0,0v2c0,0.1,0,0.3,0,0.4v7c0,3.8,0.3,7,0.9,9.5c0.6,2.6,1.6,4.6,2.9,6.1c1.3,1.5,2.9,2.6,4.9,3.2
c1.9,0.6,4.2,0.9,6.8,0.9c2.6,0,4.9-0.3,6.8-0.9c1.9-0.6,3.6-1.7,4.9-3.2c1.3-1.5,2.3-3.5,2.9-6.1c0.6-2.6,0.9-5.8,0.9-9.8V3.5
c0.1,0,0.2,0,0.3,0c3.4,0,6.5,8.3,9.8,8.3c3.4,0,7,22.9,10.5,23.5v8.6c0,8-1,14.5-3.1,19.3c-2,4.8-10.4,8.5-13.9,11
C103.7,76.8,100.3,80.3,87.3,80.3"/>
<path fill="#009FE3" d="M124.1,76.8V36.4c0-8-1-14.5-3.1-19.3c-2-4.8-4.8-8.5-8.2-11c-3.4-2.5-7.4-4.2-12-4.9
c-4.1-0.7-8.5-1-12.9-1.1C83.5,0.1,79.1,0.4,75,1.1c-4.6,0.8-8.6,2.4-12,4.9c-3.4,2.5-6.2,6.2-8.2,11c-2,4.8-3.1,11.3-3.1,19.3v7.4
c0,3.8-0.3,7-0.9,9.5c-0.6,2.6-1.6,4.6-2.9,6.1C46.6,60.9,45,62,43,62.6c-1.9,0.6-4.2,0.9-6.8,0.9c-2.6,0-4.9-0.3-6.8-0.9
c-1.9-0.6-3.6-1.7-4.9-3.2c-1.3-1.5-2.3-3.5-2.9-6.1c-0.6-2.6-0.9-5.8-0.9-9.8V3.7c-3.5-0.6-6.9-0.9-10.3-0.9
C6.9,2.8,3.5,3.1,0,3.7v40.4c0,8,1,14.5,3.1,19.3c2,4.8,4.8,8.5,8.2,11c3.4,2.5,7.4,4.2,12,4.9c4.1,0.7,8.5,1,12.9,1.1
c4.5-0.1,8.8-0.4,12.9-1.1c4.6-0.8,8.6-2.4,12-4.9c3.4-2.5,6.2-6.2,8.2-11c1.9-4.4,2.9-10.3,3-17.4l0,0v-1.5c0-0.1,0-0.3,0-0.4l0,0
V37c0-4,0.3-7.2,0.9-9.8c0.6-2.6,1.6-4.6,2.9-6.1c1.3-1.5,2.9-2.6,4.9-3.2c1.9-0.6,4.2-0.9,6.8-0.9c2.6,0,4.9,0.3,6.8,0.9
c1.9,0.6,3.6,1.7,4.9,3.2c1.3,1.5,2.3,3.5,2.9,6.1c0.6,2.6,0.9,5.8,0.9,9.8v39.8c3.5,0.6,6.9,0.9,10.3,0.9
C117.2,77.7,120.6,77.4,124.1,76.8L124.1,76.8z"/>
</g>
</svg>

BIN
themes/thunder_amp/screenshot.png View File

Before After
Width: 588  |  Height: 438  |  Size: 61KB

+ 0
- 477
themes/thunder_amp/templates/amp-css/amp-custom-styles.html.twig View File

@@ -1,477 +0,0 @@
/* ---------- Layout ----------- */

html {
height: 100%;
}

body {
min-height: 100%;
}

.amp-header__content,
.amp-main__content,
.amp-footer__content {
margin: 0 auto;
max-width: 620px;
}

.amp-main {
min-height: 300px;
}

.amp-main__content {
padding-top: 20px;
padding-bottom: 40px;
}

.layout-container {
max-width: 860px;
margin-left: auto;
margin-right: auto;
box-sizing: border-box;
}

/* ---------- Typography ----------- */

body {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 100%;
line-height: 1.5;
word-wrap: break-word;
}

/* --- Links --- */

a,
a.link {
text-decoration: none;
border-bottom: 1px dotted;
}

a:hover,
a:active,
a:focus,
.link:hover,
.link:active,
.link:focus {
text-decoration: none;
border-bottom-style: solid;
}

.link {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1 a,
h2 a {
border-bottom: none;
}

/* --- Headings --- */

h1,
h2,
h3,
h4,
h5,
h6,
.heading-a,
.heading-b,
.heading-c,
.heading-d,
.heading-e,
.heading-f {
font-weight: inherit;
margin: 1rem 0 0.5rem;
}

h1,
.heading-a {
font-size: 1.2rem;
color: #000;
}

h2,
.heading-b {
font-size: 1rem;
}

h3,
.heading-c {
font-size: 0.9375rem;
}

h4,
.heading-d {
font-size: 0.875rem;
}

h5,
h6,
.heading-e,
.heading-f {
text-transform: uppercase;
letter-spacing: 0.1em;
}

h5,
.heading-e {
font-size: 0.75rem;
}

h6,
.heading-f {
font-size: 0.625rem;
}

/* --- Text --- */

p {
margin: 0 0 1rem;
}

del {
text-decoration: line-through;
}

blockquote {
background: #f7f7f7;
border-left: 1px solid #bbb; /* LTR */
font-style: italic;
margin: 1.3125rem 10px;
padding: 0.4375rem 10px;
}

[dir="rtl"] blockquote {
border-left: none;
border-right: 1px solid #bbb;
}

blockquote:before {
color: #bbb;
content: "\201C";
font-size: 2.625rem;
line-height: 0.1;
margin-right: 0.153125rem; /* LTR */
vertical-align: -0.30625rem;
}

[dir="rtl"] blockquote:before {
content: "\201D";
margin-left: 0.153125rem;
margin-right: 0;
}

blockquote:after {
color: #bbb;
content: "\201D";
font-size: 2.625rem;
line-height: 0.1;
vertical-align: -0.39375rem;
}

[dir="rtl"] blockquote:after {
content: "\201C";
}

blockquote > p:first-child {
display: inline;
}

img {
max-width: 100%;
height: auto;
}

ul, ol {
margin: 0;
padding: 0 0 0.21875rem 0.875rem; /* LTR */
}

[dir="rtl"] ul,
[dir="rtl"] ol {
padding: 0 0.875rem 0.21875rem 0;
}

ol ol,
ul ul {
margin: 0;
padding: 0 0 0.21875rem 0.875rem; /* LTR */
}

[dir="rtl"] ol ol,
[dir="rtl"] ul ul {
padding: 0 0.875rem 0.21875rem 0;
}

/* ---------- Colors ----------- */

body {
background: #292929;
color: #3b3b3b;
}

.amp-header {
background-color: #1d84c3;
background-image: -webkit-linear-gradient(top, #055a8e 0%, #1d84c3 100%);
background-image: linear-gradient(to bottom, #055a8e 0%, #1d84c3 100%);
}

.amp-main {
background-color: #ffffff;
}

.amp-footer {
background: #292929;
}

a,
.link {
color: #0071b3;
}

a:hover,
a:focus,
.link:hover,
.link:focus {
color: #018fe2;
}

a:active,
.link:active {
color: #23aeff;
}

.amp-header,
.amp-header a,
.amp-header li a.is-active,
.site-branding__text,
.site-branding,
.site-branding__text a,
.site-branding a {
color: #fffeff;
}

/* ---------- Utility classes ----------- */

.hidden {
display: none;
}

.visually-hidden {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
height: 1px;
width: 1px;
word-wrap: normal;
}

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
position: static;
clip: auto;
overflow: visible;
height: auto;
width: auto;
}

.invisible {
visibility: hidden;
}

.clearfix:after {
content: "";
display: table;
clear: both;
}

/* ---------- Header ----------- */

.amp-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.amp-header__content {
padding: 0.75rem .9375rem 0.75rem;
}


.amp-header a {
border-bottom: none;
}

.brand {
margin: 0.375rem auto 0.375rem;
}

.site-branding__logo {
display: inline-block;
margin-right: 0.875rem; /* LTR */
margin-bottom: 0.25rem;
width: 6rem;
}

[dir="rtl"] .site-branding__logo {
margin-right: 0;
margin-left: 1em;
}

.site-branding__text {
display: inline-block;
vertical-align: top;
}

.site-branding__name {
font-size: 1.375rem;
color: #686868;
line-height: 1;
}

.site-branding__slogan {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 0.8125rem;
margin-top: 7px;
word-spacing: 0.1em;
font-style: italic;
}

/* ---------- Footer ----------- */

.amp-footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.amp-footer__content {
color: #c0c0c0;
color: rgba(255, 255, 255, 0.65);
font-size: 0.75rem;
padding: 2rem 1rem 2rem;
}

.amp-footer a,
.amp-footer a.is-active {
color: #fcfcfc;
color: rgba(255, 255, 255, 0.8);
}

.amp-footer a:hover,
.amp-footer a:focus {
color: #fefefe;
color: rgba(255, 255, 255, 0.95);
}


/* ---------- Skip Link ----------- */

.amp-skip-link {
left: 50%;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translateX(-50%);
z-index: 50;
background: #444;
background: rgba(0, 0, 0, 0.6);
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 0.94em;
line-height: 1.7em;
padding: 1px 10px 2px;
border-radius: 0 0 10px 10px;
border-bottom-width: 0;
outline: 0;
}

.amp-skip-link.visually-hidden.focusable:focus {
position: absolute;
color: #fff;
}

/* ---------- Messages ----------- */

.messages__wrapper {
padding: 20px 0 5px 8px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 8px 0;
}

[dir="rtl"] .messages__wrapper {
padding: 20px 8px 5px 0;
}

.messages {
background: no-repeat 10px 17px; /* LTR */
border: 1px solid;
border-width: 1px 1px 1px 0; /* LTR */
border-radius: 2px;
padding: 15px 20px 15px 35px; /* LTR */
word-wrap: break-word;
overflow-wrap: break-word;
}

[dir="rtl"] .messages {
border-width: 1px 0 1px 1px;
background-position: right 10px top 17px;
padding-left: 20px;
padding-right: 35px;
text-align: right;
}
.messages + .messages {
margin-top: 1.538em;
}

.messages__list {
list-style: none;
padding: 0;
margin: 0;
}

.messages__item + .messages__item {
margin-top: 0.769em;
}

/* See .color-success in Seven's colors.css */
.messages--status {
color: #325e1c;
background-color: #f3faef;
border-color: #c9e1bd #c9e1bd #c9e1bd transparent; /* LTR */
background-image: url(../../../../../../core/misc/icons/73b355/check.svg);
box-shadow: -8px 0 0 #77b259; /* LTR */
}

[dir="rtl"] .messages--status {
border-color: #c9e1bd transparent #c9e1bd #c9e1bd;
box-shadow: 8px 0 0 #77b259;
margin-left: 0;
}

/* See .color-warning in Seven's colors.css */
.messages--warning {
background-color: #fdf8ed;
background-image: url(../../../../../../core/misc/icons/e29700/warning.svg);
border-color: #f4daa6 #f4daa6 #f4daa6 transparent; /* LTR */
color: #734c00;
box-shadow: -8px 0 0 #e09600; /* LTR */
}

[dir="rtl"] .messages--warning {
border-color: #f4daa6 transparent #f4daa6 #f4daa6;
box-shadow: 8px 0 0 #e09600;
}

/* See .color-error in Seven's colors.css */
.messages--error {
background-color: #fcf4f2;
color: #a51b00;
background-image: url(../../../../../../core/misc/icons/e32700/error.svg);
border-color: #f9c9bf #f9c9bf #f9c9bf transparent; /* LTR */
box-shadow: -8px 0 0 #e62600; /* LTR */
}

[dir="rtl"] .messages--error {
border-color: #f9c9bf transparent #f9c9bf #f9c9bf;
box-shadow: 8px 0 0 #e62600;
}

.messages--error p.error {
color: #a51b00;
}

+ 0
- 40
themes/thunder_amp/templates/block/block--system-branding-block.html.twig View File

@@ -1,40 +0,0 @@
{% extends "block.html.twig" %}
{#
/**
* @file
* Theme implementation for a branding block.
*
* Each branding element variable (logo, name, slogan) is only available if
* enabled in the block configuration.
*
* Available variables:
* - site_logo: Logo for site as defined in Appearance or theme settings.
* - site_logo_height: Height of the logo, if available.
* - site_logo_width: Width of the logo, if available.
* - site_name: Name for site as defined in Site information settings.
* - site_slogan: Slogan for site as defined in Site information settings.
*/
#}
{% set attributes = attributes.addClass('site-branding', 'clearfix') %}
{% block content %}
{% if site_logo and site_logo_height and site_logo_width %}
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-branding__logo">
<amp-img src="{{ site_logo }}" alt="{{ 'Home'|t }}"
height="{{ site_logo_height }}" width="{{ site_logo_width }}"
layout="responsive"
></amp-img>
</a>
{% endif %}
{% if site_name or site_slogan %}
<div class="site-branding__text">
{% if site_name %}
<div class="site-branding__name">
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
</div>
{% endif %}
{% if site_slogan %}
<div class="site-branding__slogan">{{ site_slogan }}</div>
{% endif %}
</div>
{% endif %}
{% endblock %}

+ 0
- 27
themes/thunder_amp/templates/field--media--gallery.html.twig View File

@@ -1,27 +0,0 @@
{{ attach_library('amp/amp.carousel') }}
{% if label_hidden %}
{% if multiple %}
<amp-carousel{{ attributes }} layout="responsive" type="slides" width="850" height="478">
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</amp-carousel>
{% else %}
{% for item in items %}
<div{{ attributes }}>{{ item.content }}</div>
{% endfor %}
{% endif %}
{% else %}
<div{{ attributes }}>
<div{{ title_attributes }}>{{ label }}</div>
{% if multiple %}
<amp-carousel layout="responsive" type="slides">
{% endif %}
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
{% if multiple %}
</amp-carousel>
{% endif %}
</div>
{% endif %}

+ 0
- 66
themes/thunder_amp/templates/layout/page.html.twig View File

@@ -1,66 +0,0 @@
{#
/**
* @file
* Theme override to display a single page.
*
* The doctype, html, head and body tags are not in this template. Instead they
* can be found in the html.html.twig template in this directory.
*
* Available variables:
*
* General utility variables:
* - base_path: The base URL path of the Drupal installation. Will usually be
* "/" unless you have installed Drupal in a sub-directory.
* - is_front: A flag indicating if the current page is the front page.
* - logged_in: A flag indicating if the user is registered and signed in.
* - is_admin: A flag indicating if the user has permission to access
* administration pages.
*
* Site identity:
* - front_page: The URL of the front page. Use this instead of base_path when
* linking to the front page. This includes the language domain or prefix.
*
* Page content (in order of occurrence in the default page.html.twig):
* - messages: Status and error messages. Should be displayed prominently.
* - node: Fully loaded node, if there is an automatically-loaded node
* associated with the page and the node ID is the second argument in the
* page's path (e.g. node/12345 and node/12345/revisions, but not
* comment/reply/12345).
*
* Regions:
* - page.header: Items for the header region.
* - page.primary_menu: Items for the primary menu region.
* - page.secondary_menu: Items for the secondary menu region.
* - page.highlighted: Items for the highlighted content region.
* - page.help: Dynamic help text, mostly for admin pages.
* - page.content: The main content of the current page.
* - page.sidebar_first: Items for the first sidebar.
* - page.sidebar_second: Items for the second sidebar.
* - page.footer: Items for the footer region.
* - page.breadcrumb: Items for the breadcrumb region.
*
* @see template_preprocess_page()
* @see html.html.twig
*/
#}

<header role="banner" class="amp-header">
<div class="amp-header__content">
{{ page.header }}
</div>
</header>

<main role="main" class="amp-main">
<a id="main-content" tabindex="-1"></a>{# link is in html.html.twig #}
<div class="amp-main__content">
{{ page.content }}
</div>
</main>

{% if page.footer %}
<footer role="contentinfo" class="amp-footer">
<div class="amp-footer__content">
{{ page.footer }}
</div>
</footer>
{% endif %}

+ 0
- 7
themes/thunder_amp/templates/media--source-oembed--derivative-video--provider-vimeo.html.twig View File

@@ -1,7 +0,0 @@
{{ attach_library('amp/amp.vimeo') }}
<amp-vimeo
data-videoid="{{ videoid }}"
layout="responsive"
width="{{ attributes.width }}" height="{{ attributes.height }}">

</amp-vimeo>

+ 0
- 7
themes/thunder_amp/templates/media--source-oembed--derivative-video--provider-youtube.html.twig View File

@@ -1,7 +0,0 @@
{{ attach_library('amp/amp.youtube') }}
<amp-youtube
data-videoid="{{ videoid }}"
layout="responsive"
width="{{ attributes.width }}" height="{{ attributes.height }}">

</amp-youtube>

+ 0
- 7
themes/thunder_amp/templates/media-type-instagram-post.html.twig View File

@@ -1,7 +0,0 @@
{{ attach_library('amp/amp.instagram') }}
<amp-instagram
data-shortcode="{{ shortcode }}"
width="400"
height="400"
layout="responsive">
</amp-instagram>

+ 0
- 9
themes/thunder_amp/templates/media-type-twitter-tweet.html.twig View File

@@ -1,9 +0,0 @@
{{ attach_library('amp/amp.twitter') }}
<amp-twitter width="486" height="694"
layout="responsive"
data-tweetid="{{ tweetid }}"
data-cards="true">
{#<blockquote placeholder {{ attributes }}>
<a href="{{ path }}">{{ path }}</a>
</blockquote>#}
</amp-twitter>

+ 0
- 29
themes/thunder_amp/templates/misc/status-messages.html.twig View File

@@ -1,29 +0,0 @@
{% extends "@classy/misc/status-messages.html.twig" %}
{#
/**
* @file
* Default theme implementation for status messages.
*
* Displays status, error, and warning messages, grouped by type.
*
* An invisible heading identifies the messages for assistive technology.
* Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
* for info.
*
* Add an ARIA label to the contentinfo area so that assistive technology
* user agents will better describe this landmark.
*
* Available variables:
* - message_list: List of messages to be displayed, grouped by type.
* - status_headings: List of all status types.
* - display: (optional) May have a value of 'status' or 'error' when only
* displaying messages of that specific type.
*/
#}
{% block messages %}
{% if message_list is not empty %}
<div class="messages__wrapper layout-container">
{{ parent() }}
</div>
{% endif %}
{% endblock messages %}

+ 0
- 12
themes/thunder_amp/templates/navigation/amp-skip-link.html.twig View File

@@ -1,12 +0,0 @@
{#
/**
* @file
* Theme override of a skip link.
*
* Available variables:
* - skiptext: Text for the skip link.
*/
#}
<a href="#main-content" class="visually-hidden focusable amp-skip-link">
{{ skiptext }}
</a>

+ 0
- 10
themes/thunder_amp/templates/paragraph--paragraphs-riddle-marketplace.html.twig View File

@@ -1,10 +0,0 @@
{{ attach_library('amp/amp.iframe') }}
<amp-iframe
width="375" height="462"
{# Heights can be used to prevent having empty space under the riddle, on bigger screens #}
{#heights="(max-width: 375px) 462px, (max-width: 425px) 490px, (max-width:543px) 560px, 600px"#}
layout="responsive"
frameborder="0"
sandbox="allow-scripts allow-same-origin"
src="{{ paragraph.field_link.uri }}">
</amp-iframe>

+ 0
- 10
themes/thunder_amp/thunder_amp.info.yml View File

@@ -1,10 +0,0 @@
name: Thunder AMP
type: theme
base theme: amptheme
description: An AMP subtheme for Thunder.
package: Custom
core: 8.x
regions:
header: Header
content: Content
footer: Footer

+ 0
- 68
themes/thunder_amp/thunder_amp.theme View File

@@ -1,68 +0,0 @@
<?php

/**
* @file
* Preprocess html for thunder_amp theme.
*/

/**
* Implements hook_preprocess_HOOK() for HTML document templates.
*
* Example of a preprocess hook for a subtheme that could be used to change
* variables in templates in order to support custom styling of AMP pages.
*/
function thunder_amp_preprocess_html(&$variables) {

}

/**
* Implements hook_preprocess_HOOK().
*/
function thunder_amp_preprocess_media__source_oembed__derivative_video__provider_youtube(&$variables) {
/** @var \Drupal\media\Entity\Media $media */
$media = $variables['media'];
$url = $media->getSource()->getSourceFieldValue($media);

preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
$variables['videoid'] = $match[1];

_thunder_amp_set_oembed_attributes($variables, $url);
}

/**
* Implements hook_preprocess_HOOK().
*/
function thunder_amp_preprocess_media__source_oembed__derivative_video__provider_vimeo(&$variables) {
/** @var \Drupal\media\Entity\Media $media */
$media = $variables['media'];
$url = $media->getSource()->getSourceFieldValue($media);

preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(?:[?]?.*)$%im', $url, $match);
$variables['videoid'] = $match[3];

_thunder_amp_set_oembed_attributes($variables, $url);
}

/**
* Set's width and height for oEmbed items.
*/
function _thunder_amp_set_oembed_attributes(&$variables, $url) {
/** @var \Drupal\media\OEmbed\UrlResolverInterface $url_resolver */
$url_resolver = \Drupal::service('media.oembed.url_resolver');
$resource_url = $url_resolver->getResourceUrl($url);

/** @var \Drupal\media\OEmbed\ResourceFetcherInterface $resource_fetcher */
$resource_fetcher = \Drupal::service('media.oembed.resource_fetcher');
$resource = $resource_fetcher->fetchResource($resource_url);

$variables['attributes']['width'] = $resource->getWidth();
$variables['attributes']['height'] = $resource->getHeight();
}

/**
* Implements hook_preprocess_HOOK().
*/
function thunder_amp_preprocess_media_twitter_tweet(&$variables) {
$explodedUrl = explode('/', $variables['path']);
$variables['tweetid'] = end($explodedUrl);
}

Loading…
Cancel
Save