Verified Commit 3fe2df71 authored by alexpott's avatar alexpott
Browse files

Issue #3253286 by lauriii, ckrina, bnjmnm, xjm: Remove unnecessary template...

Issue #3253286 by lauriii, ckrina, bnjmnm, xjm: Remove unnecessary template overrides and associated code from starterkit theme
parent b4011fbf
/**
* @file
* Styling for the Book module.
*/
.book-navigation .menu {
padding-top: 1em;
padding-bottom: 0;
}
.book-navigation .book-pager {
overflow: auto;
margin: 0;
padding: 0.5em 0;
}
.book-pager__item {
display: inline-block;
list-style-type: none;
vertical-align: top;
}
.book-pager__item--previous {
width: 45%;
text-align: left; /* LTR */
}
[dir="rtl"] .book-pager__item--previous {
float: right;
text-align: right;
}
.book-pager__item--center {
width: 8%;
text-align: center;
}
.book-pager__item--next {
float: right; /* LTR */
width: 45%;
text-align: right; /* LTR */
}
[dir="rtl"] .book-pager__item--next {
float: left;
text-align: left;
}
/**
* @file
* Styling for the Forum module.
*/
.forum__description {
margin: 0.5em;
font-size: 0.9em;
}
.forum__icon {
float: left; /* LTR */
width: 24px;
height: 24px;
margin: 0 9px 0 0; /* LTR */
background-image: url(../../images/icons/forum-icons.png);
background-repeat: no-repeat;
}
[dir="rtl"] .forum__icon {
float: right;
margin: 0 0 0 9px;
}
.forum__title {
overflow: hidden;
}
.forum .indented {
margin-left: 20px; /* LTR */
}
[dir="rtl"] .forum .indented {
margin-right: 20px;
margin-left: 0;
}
.forum__topic-status--new {
background-position: -24px 0;
}
.forum__topic-status--hot {
background-position: -48px 0;
}
.forum__topic-status--hot-new {
background-position: -72px 0;
}
.forum__topic-status--sticky {
background-position: -96px 0;
}
.forum__topic-status--closed {
background-position: -120px 0;
}
/**
* @file
* Media Embed filter: default styling for media embed errors.
*/
/**
* The caption filter's styling overrides ours, so add a more specific selector
* to account for that.
*/
.media-embed-error,
.caption > .media-embed-error {
max-width: 200px;
padding: 100px 20px 20px;
text-align: center;
background-color: #ebebeb;
background-image: url(../../images/icons/no-thumbnail.png);
background-repeat: no-repeat;
background-position: center top;
background-size: 100px 100px;
}
/**
* @file
* Contains minimal layout styling for the media library.
*/
.media-library-wrapper {
display: flex;
}
.media-library-menu {
flex-basis: 20%;
flex-shrink: 0;
}
.media-library-content {
flex-grow: 1;
}
.media-library-views-form {
display: flex;
flex-wrap: wrap;
}
.media-library-views-form .media-library-item {
justify-content: space-between;
max-width: 23%;
margin: 1%;
}
/**
* @file
* Theme overrides for the Media Embed CKEditor plugin.
*/
((Drupal) => {
/**
* Themes the error displayed when the media embed preview fails.
*
* @param {string} error
* The error message to display
*
* @return {string}
* A string representing a DOM fragment.
*
* @see media-embed-error.html.twig
*/
Drupal.theme.mediaEmbedPreviewError = () =>
`<div class="media-embed-error media-embed-error--preview-error">${Drupal.t(
'An error occurred while trying to preview the media. Please save your work and reload this page.',
)}</div>`;
})(Drupal);
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function (Drupal) {
Drupal.theme.mediaEmbedPreviewError = function () {
return "<div class=\"media-embed-error media-embed-error--preview-error\">".concat(Drupal.t('An error occurred while trying to preview the media. Please save your work and reload this page.'), "</div>");
};
})(Drupal);
\ No newline at end of file
......@@ -19,11 +19,3 @@ libraries-extend:
- starterkit_theme/file
core/drupal.progress:
- starterkit_theme/progress
media/media_embed_ckeditor_theme:
- starterkit_theme/media_embed_ckeditor_theme
media_library/view:
- starterkit_theme/media_library
media_library/widget:
- starterkit_theme/media_library
ckeditor_stylesheets:
- css/components/media-embed-error.css
......@@ -48,11 +48,6 @@ base:
weight: -10
css/components/ui-dialog.css:
weight: -10
book-navigation:
version: VERSION
css:
component:
css/components/book-navigation.css: { }
dialog:
version: VERSION
css:
......@@ -71,12 +66,6 @@ file:
component:
css/components/file.css:
weight: -10
forum:
version: VERSION
css:
component:
css/components/forum.css:
weight: -10
image-widget:
version: VERSION
css:
......@@ -87,11 +76,6 @@ indented:
css:
component:
css/components/indented.css: { }
media_library:
version: VERSION
css:
layout:
css/layout/media-library.css: { }
messages:
version: VERSION
css:
......@@ -121,12 +105,3 @@ user:
component:
css/components/user.css:
weight: -10
media_embed_error:
version: VERSION
css:
component:
css/components/media-embed-error.css: { }
media_embed_ckeditor_theme:
version: VERSION
js:
js/media_embed_ckeditor.theme.js: { }
......@@ -5,34 +5,6 @@
* Functions to support theming.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Form\ViewsForm;
/**
* Implements hook_preprocess_links__media_library_menu().
*
* This targets the menu of available media types in the media library's modal
* dialog.
*
* @todo Do this in the relevant template once
* https://www.drupal.org/project/drupal/issues/3088856 is resolved.
*/
function starterkit_theme_preprocess_links__media_library_menu(array &$variables) {
foreach ($variables['links'] as &$link) {
$link['link']['#options']['attributes']['class'][] = 'media-library-menu__link';
}
}
/**
* Implements hook_form_alter().
*/
function starterkit_theme_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
$form_object = $form_state->getFormObject();
if ($form_object instanceof ViewsForm && strpos($form_object->getBaseFormId(), 'views_form_media_library') === 0) {
$form['#attributes']['class'][] = 'media-library-views-form';
}
}
/**
* Implements hook_preprocess_image_widget().
*/
......
{#
/**
* @file
* Theme override to present a feed item in an aggregator page.
*
* Available variables:
* - url: URL to the originating feed item.
* - title: (optional) Title of the feed item.
* - content: All field items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given element.
* - attributes: HTML attributes for the wrapper.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_aggregator_item()
*/
#}
<article{{ attributes.addClass('aggregator-item') }}>
{{ title_prefix }}
{% if title %}
<h3 class="feed-item-title">
<a href="{{ url }}">{{ title }}</a>
</h3>
{% endif %}
{{ title_suffix }}
{{ content }}
</article>
{#
/**
* @file
* Theme override for a single node in a printer-friendly outline.
*
* Available variables:
* - node: Fully loaded node.
* - depth: Depth of the current node inside the outline.
* - title: Node title.
* - content: Node content.
* - children: All the child nodes recursively rendered through this file.
*
* @see template_preprocess_book_node_export_html()
*/
#}
<article id="node-{{ node.id }}" class="section-{{ depth }}">
<h1 class="book-heading">{{ title }}</h1>
{{ content }}
{{ children }}
</article>
{#
/**
* @file
* Theme override for a missing media error.
*
* Available variables
* - message: The message text.
* - attributes: HTML attributes for the containing element.
*
* When a response from the back end can't be returned, a related error message
* is displayed from JavaScript.
*
* @see Drupal.theme.mediaEmbedPreviewError
*
* @ingroup themeable
*/
#}
{{ attach_library('starterkit_theme/media_embed_error') }}
<div{{ attributes.addClass('media-embed-error', 'media-embed-error--missing-source') }}>
{{ message }}
</div>
{#
/**
* @file
* Theme override to present an aggregator feed.
*
* The contents are rendered above feed listings when browsing source feeds.
* For example, "example.com/aggregator/sources/1".
*
* Available variables:
* - title: (optional) Title of the feed item.
* - content: All field items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given element.
* - attributes: HTML attributes for the wrapper.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_aggregator_feed()
*/
#}
<div{{ attributes.addClass('aggregator-feed') }}>
{{ title_prefix }}
{% if title and not full %}
<h2{{ title_attributes }}>{{ title }}</h2>
{% endif %}
{{ title_suffix }}
{{ content }}
</div>
{#
/**
* @file
* Theme override to display a status icon for a forum post.
*
* Available variables:
* - attributes: HTML attributes to be applied to the wrapper element.
* - class: HTML classes that determine which icon to display. May be one of
* 'hot', 'hot-new', 'new', 'default', 'closed', or 'sticky'.
* - title: Text alternative for the forum icon.
* - icon_title: Text alternative for the forum icon, same as above.
* - new_posts: '1' when this topic contains new posts, otherwise '0'.
* - first_new: '1' when this is the first topic with new posts, otherwise '0'.
* - icon_status: Indicates which status icon should be used.
*
* @see template_preprocess_forum_icon()
*/
#}
{%
set classes = [
'forum__icon',
'forum__topic-status--' ~ icon_status,
]
%}
<div{{ attributes.addClass(classes) }}>
{% if first_new -%}
<a id="new"></a>
{%- endif %}
<span class="visually-hidden">{{ icon_title }}</span>
</div>
{#
/**
* @file
* Theme override to display a list of forums and containers.
*
* Available variables:
* - forums: A collection of forums and containers to display. It is keyed to
* the numeric IDs of all child forums and containers. Each forum in forums
* contains:
* - is_container: A flag indicating if the forum can contain other
* forums. Otherwise, the forum can only contain topics.
* - depth: How deep the forum is in the current hierarchy.
* - zebra: 'even' or 'odd', used for row class.
* - icon_class: 'default' or 'new', used for forum icon class.
* - icon_title: Text alternative for the forum icon.
* - name: The name of the forum.
* - link: The URL to link to this forum.
* - description: The description field for the forum, containing:
* - value: The descriptive text for the forum.
* - new_topics: A flag indicating if the forum contains unread posts.
* - new_url: A URL to the forum's unread posts.
* - new_text: Text for the above URL, which tells how many new posts.
* - old_topics: A count of posts that have already been read.
* - num_posts: The total number of posts in the forum.
* - last_reply: Text representing the last time a forum was posted or
* commented in.
* - forum_id: Forum ID for the current forum. Parent to all items within the
* forums array.
*
* @see template_preprocess_forum_list()
*/
#}
<table id="forum-{{ forum_id }}">
<thead>
<tr>
<th>{{ 'Forum'|t }}</th>
<th>{{ 'Topics'|t }}</th>
<th>{{ 'Posts'|t }}</th>
<th>{{ 'Last post'|t }}</th>
</tr>
</thead>
<tbody>
{% for child_id, forum in forums %}
<tr id="forum-list-{{ child_id }}" class="{{ forum.zebra }}">
<td {% if forum.is_container == true -%}
colspan="4" class="container"
{%- else -%}
class="forum-list__forum"
{%- endif -%}>
{#
Enclose the contents of this cell with X divs, where X is the
depth this forum resides at. This will allow us to use CSS
left-margin for indenting.
#}
{% if forum.depth > 0 %}{% for i in 1..forum.depth %}<div class="indented">{% endfor %}{% endif %}
<div class="forum__icon forum-status-{{ forum.icon_class }}" title="{{ forum.icon_title }}">
<span class="visually-hidden">{{ forum.icon_title }}</span>
</div>
<div class="forum__name"><a href="{{ forum.link }}">{{ forum.label }}</a></div>
{% if forum.description.value %}
<div class="forum__description">{{ forum.description.value }}</div>
{% endif %}
{% if forum.depth > 0 %}{% for i in 1..forum.depth %}</div>{% endfor %}{% endif %}
</td>
{% if forum.is_container == false %}
<td class="forum__topics">
{{ forum.num_topics }}
{% if forum.new_topics == true %}
<br />
<a href="{{ forum.new_url }}">{{ forum.new_text }}</a>
{% endif %}
</td>
<td class="forum__posts">{{ forum.num_posts }}</td>
<td class="forum__last-reply">{{ forum.last_reply }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{#
/**
* @file
* Theme override to display a forum.
*
* May contain forum containers as well as forum topics.
*
* Available variables:
* - forums: The forums to display (as processed by forum-list.html.twig).
* - topics: The topics to display.
* - topics_pager: The topics pager.
* - forums_defined: A flag to indicate that the forums are configured.
*
* @see template_preprocess_forums()
*/
#}
{{ attach_library('starterkit_theme/forum') }}
{% if forums_defined %}
<div class="forum">
{{ forums }}
{{ topics }}
{{ topics_pager }}
</div>
{% endif %}
{#
/**
* @file
* Theme override for printed version of book outline.
*
* Available variables:
* - title: Top level node title.
* - head: Header tags.
* - language: Language object.
* - language_rtl: A flag indicating whether the current display language is a
* right to left language.
* - base_url: URL to the home page.
* - contents: Nodes within the current outline rendered through
* book-node-export-html.html.twig.
*
* @see template_preprocess_book_export_html()
*/
#}
<!DOCTYPE html>
<html{{ html_attributes }}>
<head>
<title>{{ title }}</title>
{{ page.head }}
<base href="{{ base_url }}" />
<link type="text/css" rel="stylesheet" href="misc/print.css" />
</head>
<body>
{#
The given node is embedded to its absolute depth in a top level section.
For example, a child node with depth 2 in the hierarchy is contained in
(otherwise empty) div elements corresponding to depth 0 and depth 1. This
is intended to support WYSIWYG output - e.g., level 3 sections always look
like level 3 sections, no matter their depth relative to the node selected
to be exported as printer-friendly HTML.
#}
{% if depth > 1 %}{% for i in 1..depth-1 %}
<div class="section-{{ i }}">
{% endfor %}{% endif %}
{{ contents }}
{% if depth > 1 %}{% for i in 1..depth-1 %}
</div>
{% endfor %}{% endif %}
</body>
</html>
{#
/**
* @file
* Theme implementation the content area of the modal media library dialog.
*
* The content area is everything that is not the menu of available media
* types. This includes the form to add new media items, if available, and
* the view of available media to select.
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - children: The rendered child elements of the container.
* - has_parent: A flag to indicate that the container has one or more parent
containers.
*
* @see template_preprocess_container()
*
* @ingroup themeable