Initial Drupal 11 with DDEV setup
This commit is contained in:
@ -0,0 +1,70 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Olivero's theme override for comment body field.
|
||||
*
|
||||
* Available variables:
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
* - label_hidden: Whether to show the field label or not.
|
||||
* - title_attributes: HTML attributes for the title.
|
||||
* - label: The label for the field.
|
||||
* - multiple: TRUE if a field can contain multiple items.
|
||||
* - items: List of all the field items. Each item contains:
|
||||
* - attributes: List of HTML attributes for each item.
|
||||
* - content: The field item's content.
|
||||
* - entity_type: The entity type to which the field belongs.
|
||||
* - field_name: The name of the field.
|
||||
* - field_type: The type of the field.
|
||||
* - label_display: The display settings for the label.
|
||||
*
|
||||
* @see template_preprocess_field()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
'field',
|
||||
'field--name-' ~ field_name|clean_class,
|
||||
'field--type-' ~ field_type|clean_class,
|
||||
'field--label-' ~ label_display,
|
||||
label_display == 'inline' ? 'clearfix',
|
||||
]
|
||||
%}
|
||||
{%
|
||||
set title_classes = [
|
||||
'field__label',
|
||||
label_display == 'visually_hidden' ? 'visually-hidden',
|
||||
]
|
||||
%}
|
||||
{%
|
||||
set item_classes = [
|
||||
'field__item',
|
||||
'comment__text-content',
|
||||
]
|
||||
%}
|
||||
|
||||
{% if label_hidden %}
|
||||
{% if multiple %}
|
||||
<div{{ attributes.addClass(classes, 'field__items') }}>
|
||||
{% for item in items %}
|
||||
<div{{ item.attributes.addClass(item_classes) }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% for item in items %}
|
||||
<div{{ attributes.addClass(classes, item_classes) }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div{{ attributes.addClass(classes) }}>
|
||||
<div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
|
||||
{% if multiple %}
|
||||
<div class="field__items">
|
||||
{% endif %}
|
||||
{% for item in items %}
|
||||
<div{{ item.attributes.addClass(item_classes) }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
{% if multiple %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -0,0 +1,62 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for comment fields.
|
||||
*
|
||||
* Available variables:
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
* - label_hidden: Whether to show the field label or not.
|
||||
* - title_attributes: HTML attributes for the title.
|
||||
* - label: The label for the field.
|
||||
* - 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 title output populated by modules, intended to
|
||||
* be displayed after the main title tag that appears in the template.
|
||||
* - comments: List of comments rendered through comment.html.twig.
|
||||
* - comment_count: Count of comments rendered through comment.html.twig.
|
||||
* - content_attributes: HTML attributes for the form title.
|
||||
* - comment_form: The 'Add new comment' form.
|
||||
* - comment_display_mode: Is the comments are threaded.
|
||||
* - comment_type: The comment type bundle ID for the comment field.
|
||||
* - entity_type: The entity type to which the field belongs.
|
||||
* - field_name: The name of the field.
|
||||
* - field_type: The type of the field.
|
||||
* - label_display: The display settings for the label.
|
||||
*
|
||||
* @see template_preprocess_field()
|
||||
* @see comment_preprocess_field()
|
||||
*/
|
||||
#}
|
||||
|
||||
{{ attach_library('olivero/comments') }}
|
||||
<section{{ attributes.setAttribute('data-drupal-selector', 'comments').addClass('comments') }}>
|
||||
|
||||
{% if not label_hidden %}
|
||||
{{ title_prefix }}
|
||||
<h2{{ title_attributes.addClass('comments__title') }}>
|
||||
{{- label -}}
|
||||
{%- if comments -%}
|
||||
<span class="comments__count">{{ comment_count }}</span>
|
||||
{%- endif -%}
|
||||
</h2>
|
||||
{{ title_suffix }}
|
||||
{% endif %}
|
||||
|
||||
{% if comment_form %}
|
||||
<div class="add-comment">
|
||||
{% if user_picture %}
|
||||
<div class="add-comment__picture-wrapper">
|
||||
<div class="add-comment__picture">
|
||||
{{ user_picture }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="add-comment__form">
|
||||
{{ comment_form }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ comments }}
|
||||
|
||||
</section>
|
||||
@ -0,0 +1,50 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Olivero theme override for tags field.
|
||||
*
|
||||
* Available variables:
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
* - label_hidden: Whether to show the field label or not.
|
||||
* - title_attributes: HTML attributes for the label.
|
||||
* - label: The label for the field.
|
||||
* - content_attributes: HTML attributes for the content.
|
||||
* - items: List of all the field items. Each item contains:
|
||||
* - attributes: List of HTML attributes for each item.
|
||||
* - content: The field item's content.
|
||||
* - entity_type: The entity type to which the field belongs.
|
||||
* - field_name: The name of the field.
|
||||
* - field_type: The type of the field.
|
||||
* - label_display: The display settings for the label.
|
||||
*
|
||||
* @see template_preprocess_field()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
'field',
|
||||
'field--name-' ~ field_name|clean_class,
|
||||
'field--type-' ~ field_type|clean_class,
|
||||
'field--label-' ~ label_display,
|
||||
'field--tags',
|
||||
]
|
||||
%}
|
||||
{%
|
||||
set title_classes = [
|
||||
'field__label',
|
||||
'field--tags__label',
|
||||
label_display == 'visually_hidden' ? 'visually-hidden',
|
||||
]
|
||||
%}
|
||||
|
||||
{{ attach_library('olivero/tags') }}
|
||||
<div{{ attributes.addClass(classes) }}>
|
||||
{% if not label_hidden %}
|
||||
<h3{{ title_attributes.addClass(title_classes) }}>{{ label }}</h3>
|
||||
{% endif %}
|
||||
<ul class="links field__items field--tags__items">
|
||||
{% for item in items %}
|
||||
<li{{ item.attributes.addClass('field--tags__item') }}>{{ item.content }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
{% extends "field--text.html.twig" %}
|
||||
@ -0,0 +1 @@
|
||||
{% extends "field--text.html.twig" %}
|
||||
@ -0,0 +1,20 @@
|
||||
{% extends "field.html.twig" %}
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for a text field.
|
||||
*
|
||||
* A 'clearfix' class is added, because 'text' fields have a 'format' property
|
||||
* that allows a Text Format to be associated with the entered text, which then
|
||||
* applies filtering on output. A common use case is to align images to the left
|
||||
* or right, and without this 'clearfix' class, such aligned images may be
|
||||
* rendered outside of the 'text' field formatter's boundaries, and hence
|
||||
* overlap with other fields. By setting the 'clearfix' class on all 'text'
|
||||
* fields, we prevent that.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2358529
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
{% set attributes = attributes.addClass('clearfix') %}
|
||||
81
web/core/themes/olivero/templates/field/field.html.twig
Normal file
81
web/core/themes/olivero/templates/field/field.html.twig
Normal file
@ -0,0 +1,81 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for a field.
|
||||
*
|
||||
* To override output, copy the "field.html.twig" from the templates directory
|
||||
* to your theme's directory and customize it, just like customizing other
|
||||
* Drupal templates such as page.html.twig or node.html.twig.
|
||||
*
|
||||
* Instead of overriding the theming for all fields, you can also just override
|
||||
* theming for a subset of fields using
|
||||
* @link themeable Theme hook suggestions. @endlink For example,
|
||||
* here are some theme hook suggestions that can be used for a field_foo field
|
||||
* on an article node type:
|
||||
* - field--node--field-foo--article.html.twig
|
||||
* - field--node--field-foo.html.twig
|
||||
* - field--node--article.html.twig
|
||||
* - field--field-foo.html.twig
|
||||
* - field--text-with-summary.html.twig
|
||||
* - field.html.twig
|
||||
*
|
||||
* Available variables:
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
* - label_hidden: Whether to show the field label or not.
|
||||
* - title_attributes: HTML attributes for the title.
|
||||
* - label: The label for the field.
|
||||
* - multiple: TRUE if a field can contain multiple items.
|
||||
* - items: List of all the field items. Each item contains:
|
||||
* - attributes: List of HTML attributes for each item.
|
||||
* - content: The field item's content.
|
||||
* - entity_type: The entity type to which the field belongs.
|
||||
* - field_name: The name of the field.
|
||||
* - field_type: The type of the field.
|
||||
* - label_display: The display settings for the label.
|
||||
*
|
||||
*
|
||||
* @see template_preprocess_field()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
'field',
|
||||
'field--name-' ~ field_name|clean_class,
|
||||
'field--type-' ~ field_type|clean_class,
|
||||
'field--label-' ~ label_display,
|
||||
label_display == 'inline' ? 'clearfix',
|
||||
]
|
||||
%}
|
||||
{%
|
||||
set title_classes = [
|
||||
'field__label',
|
||||
label_display == 'visually_hidden' ? 'visually-hidden',
|
||||
]
|
||||
%}
|
||||
|
||||
{% if label_hidden %}
|
||||
{% if multiple %}
|
||||
<div{{ attributes.addClass(classes, 'field__items') }}>
|
||||
{% for item in items %}
|
||||
<div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% for item in items %}
|
||||
<div{{ attributes.addClass(classes, 'field__item') }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div{{ attributes.addClass(classes) }}>
|
||||
<div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
|
||||
{% if multiple %}
|
||||
<div class="field__items">
|
||||
{% endif %}
|
||||
{% for item in items %}
|
||||
<div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
{% if multiple %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user