People who code: we want your input. Take the Survey

Questions tagged [theming]

Use it for questions about rendering or modifying the HTML markup produced by a module/theme.

Filter by
Sorted by
Tagged with
0
votes
0answers
40 views

Parent Theme overriding Subtheme on certain paths

I installed the Opgino installation for Drupal 8 and created a sub-theme for default theme that comes with Opigno. The subtheme works as it should, except on certain paths. Anything with a path of /...
1
vote
0answers
85 views

Add a template suggestion with highest-priority in custom module

It's easy to override an existing template in custom theme using one of the template suggestions or just by copying the desired template file and past it under custom theme templates directory. But ...
0
votes
0answers
9 views

How can I create the functionality to assign icon per field type in field settings form?

I would like add a new setting for field which would allow to choose a icon for a field same as cardinality or any other settings. /admin/structure/types/manage/[content_Type]/fields/field_[...
0
votes
0answers
99 views

How do I correctly sort merged arrays in a template file?

I have a content type in Drupal 8 with some fields referencing to taxonomy terms. I like to display these terms all together in one sorted array, so I merge the fields and sort them. But the result is ...
2
votes
1answer
169 views

How to render a text with linebreak saved from a textarea form?

Unfortunately I haven't found anything on the web with this specific problem. I have a field (text, formatted, long) and a form with a textarea element that should save the entered text to this field....
0
votes
1answer
164 views

Splitting field value inside field template not working?

I have a twig template for some text field. Inside it I'm displaying the value like (it's single value field): {% for item in items %} {{ item.content}} {% endfor %} And it's displaying value ...
1
vote
0answers
210 views

What to use instead of raw twig filter? [duplicate]

I created a field field_quantity_description that contains HTML code. I can output the escaped content of this field: {{ quantity.entity.field_quantity_description.value }} I want to render HTML ...
2
votes
1answer
196 views

Render private image on twig template

I have a content type with a private image field. I would like to render the image on the twig template in order to show it to the user when it has enough permission, but the image source is a private ...
0
votes
1answer
159 views

Why isn't my sub-theme using its CSS file?

I created a sub-theme of the Drupal8 W3CSS theme and followed their directions about copying and renaming files, and editing the info.yml file. I installed it, and set it as default theme. It works. (...
1
vote
1answer
225 views

How can I remove unwanted CSS found in the parent theme? [duplicate]

I'm working on a sub-theme of Bootstrap Barrio, which includes a table.css stylesheet. I don't want this stylesheet from the parent theme to be included in my sub-theme. How do I eliminate a CSS ...
0
votes
1answer
102 views

Add CSS class to fieldset div element without extending the template

I only want to add a class to the inside the fieldset from fieldset.html.twig. It's a bit overkill to extend the template for just to add a class. How can I achieve this with a preprocess function? ...
0
votes
1answer
42 views

Fetching and rendering custom-library generated blocks in twig

I am using the following code in my theme to fetch 3 blocks (each containing 4 fields) generated via the custom block library interface i:e all 3 block are of the HomePage-Block type: function ...
0
votes
1answer
32 views

Output node reference field data in page.html.twig

I have a homepage node-type in which I have an entity-reference field holding 3 references to 3 separate custom blocks. The theme I'm working on requires that my 3 element reference field needs to be ...
0
votes
1answer
123 views

Can not override template for specific view

I'm new to Drupal so this might be a noobish question. I have a view called 'Category' where all posts are listed that belongs to the chosen category. I would like to override the views-view-...
1
vote
0answers
14 views

Exposed form block disappear when views has no results

I created a view template for my website in which i put my exposed form block with twig tweak module. It works when there is at least 1 result. But when my view has no result, the exposed form ...
0
votes
1answer
68 views

Naming convention for field type templates?

It seems that the naming convention for field types is undocumented. Looking at the classy theme shows a seemingly arbitrary convention. For example, the Text (formatted, long, with summary) type as ...
1
vote
1answer
26 views

separate the page title from page content

I am using {{ page.content }} to print all my page content. It is printing my all content but I want to remove title from this content and print it separately in different div structure (without using ...
0
votes
1answer
77 views

Specifying display of a new Paragraph type with images using HTML/twig?

I created "figure" Paragraphs type, which contains an image field and a caption field. How (from start to finish) do I specify in HTML/twig how to render this new Paragraphs type? As an example, how ...
0
votes
0answers
30 views

How do I apply HTML IDs to field output result?

I'm trying to build a block for tb_megamenu of a view of items of a certain content type. I want to use some JavaScript so that when the end user hovers over a title then associated content appears on ...
3
votes
2answers
363 views

How should I include <link> or <style> inside <head>?

I'm trying to use a Google font, which requires adding either a <link> or <style> section inside the <head> per the below instructions. I am using a subtheme and can modify the ...
-4
votes
1answer
47 views

How do I add CSS classes to all the form elements?

How can I add the same CSS class (form__text) to form elements in Drupal 8?
0
votes
0answers
45 views

Add a region to the page--front.html.twig

I've created a few new region in my yml regions: header: "Header" jumbotron: "Jumbotron" chiffres: "Chiffres" steps: "Etapes" presentation: "Presentation des formules" ...
0
votes
1answer
134 views

How to check if custom variation field is null in twig?

I would like to know how to check if a custom variation field has content in a twig template (commerce-product.html.twig with variations injected). I have tried with some filters and conditions but ...
2
votes
1answer
35 views

How to pass field value to referenced node template?

I have content type A. It has field reference to content type B. I'm rendering referenced node B from content type A twig template like: {{ content.field_referenced_object }} And that works well. ...
0
votes
0answers
49 views

How to display field_tags of a node in html.html.twig? [duplicate]

I want to display fields "field_summary" and "field_tags" of a node in html.html.twig (without using a module for that). I was already able to get "field_summary" value in html.html.twig with this ...
1
vote
1answer
166 views

twig template suggestion for comment reply form

there is no template suggestion for a comment reply form in Drupal 8, how can i create one? i am not talking about the reply form displayed in the node for which Drupal suggest a template : field--...
0
votes
4answers
187 views

How can I design the standard user login form with twig?

I want to change the labels "Username" and "Password" and delete "Create new account" link of the standard login form of Drupal 8. Is it possible to do this with twig?
0
votes
1answer
34 views

Why do I get an error after adding a .theme file?

After creating (e.g empty) .theme file in my template folder, I get the following error message: The website encountered an unexpected error. Please try again later.RuntimeException: Failed to ...
0
votes
1answer
84 views

Why does my do-nothing subtheme break the parent theme?

I'm trying to get started with sub theming in Drupal 8. I followed the example from the Drupal documentation and created what I thought was supposed to be an unmodified inherited copy of the Bartik ...
0
votes
0answers
21 views

View only part of an image?

I am not sure if this can be done with core or Module settings, or require some tricky CSS work. I have an image that is part of a slideshow that goes all the way across the page no matter how wide ...
0
votes
1answer
37 views

Manually laying out specific articles on page

I'm making a newspaper site and would like to manually lay out and embed a specific set of articles for the front page. Is there a way I can manually code the layout in columns and embed specific ...
0
votes
1answer
24 views

render call in hook_node_presave uses admin theme

I am using hook_node_presave() to render my node and then save the output to a field field_node_cache. However, when I do this, the renderer uses the admin theme, whereas I would like to use the site'...
1
vote
1answer
53 views

Suggested template file is not working for Custom Search's template

I have installed Custom Search module for my drupal7 setup. I am trying to modify template files for search-result and search-results. By default its using template files from contrib module's theme ...
0
votes
1answer
32 views

Modify user profile page, not login page

I'm trying to edit the user profile page, not the login page. However, with Drupal 7, the template for the profile and the login page is the same. I tried to modify page--user.tpl.php, but it also ...
0
votes
0answers
87 views

Add Is-Active class on custom link in view

How can I add Is-Active class on custom link path in view. I have created block of taxonomy term name and format is Grid view. I have added field "Name" and in its configuration given custom path link....
0
votes
1answer
63 views

Remove dots ( … ) from default search results descriptions ( snippet )

I want to remove dots from search results items descriptions to search result page ( Default Search ), i have used Drupal default search for the search result page so how to remove the dots from the ...
0
votes
0answers
42 views

Not able to load data from cookies until I clear cache [duplicate]

In my Drupal application, I have set some cookies through a javascript onClick method. However, am not able to access the data until I clear the cache(admin/config/development/performance/clear ...
0
votes
1answer
42 views

How to get different image styles in the same view?

I'am a newbie, and I want to make a simple view with an image field (in article nodes), that looks like this layout : And for this, I don't want to use CSS rules to resize the view rows images, for ...
1
vote
2answers
30 views

Custom home page not recognized by system

I have set up a Drupal 8 site with a custom home page using page--front.html.twig. The content displays at domain.com/front. When I go into Administration to change to the new home page, it says that ...
0
votes
1answer
277 views

Twig escapes tags when using raw value in template

I am printing fields in a node template, but Twig is escaping my tags and ruining my day. My .tpl looks like this: <blockquote> <p class="title">{{ content.field_myfield.0 }}</p&...
0
votes
2answers
588 views

How to access webform field labels in a twig template?

The YAML below represents a webform. Theming is simple using the twig template also found below, but the label for email is inline with the input field by default. How can the labels in the webform be ...
1
vote
0answers
194 views

How to render webform element in twig file template for HTML display

I want to override the HTML display for webform submissions. So, I have copy this file "webform-submission.html.twig" in my template folder and rename it in: "webform-submission--testform--html.html....
1
vote
1answer
644 views

How to preload a css/js library programmatically after module installation? is there api for changing *.library.yml file?

i would like to develop a module where i cached internally html,css,js statically for pages. 1) in a admin setting page i can add a bundle with 1 html page + css/js files. 2) for each bundle i have ...
3
votes
0answers
285 views

Is it possible to use libraries-extend from a module (instead of theme)?

Problem/Motivation I'm interested in altering/overriding the little bit of HTML markup that's output by core, in my case Drupal.theme.mediaEmbedEditButton (from core/modules/media/js/...
1
vote
1answer
215 views

how to display a media description in a twig template?

i want to display the media description available in the file field of a media ( media of type video, audio, image, etc...), it is an option to activate: Enable Description field The description ...
2
votes
1answer
195 views

How do I strip spaces from a Twig variable?

Example code I'm working with: <a{{ attributes.addClass(classes, 'field__item') }} name="{{ item.content }}">{{ item.content }}</a> In this example, I have created a Brick with a field ...
0
votes
1answer
621 views

How to check the Webform submission values in a twig template

I have an Webform with an option element, (option_one), with 6 options. Below this are 2 option elements with 5 and 2 options. These 2 option elements have a conditional statement to display if the ...
1
vote
2answers
559 views

How do I add CSS body classes for logged-in and logged-out users?

In Drupal 7 I would add a theme process function to add the body classes needed. function template_preprocess_html(&$variables) { $variables['classes_array'][] = $variables['is_front'] ? 'front'...
0
votes
2answers
24 views

How can I have editors select which blocks to be displayed in what order per page?

I have taken on a site that has hard coded page urls in it's page.html.twig for loading specific sidebar blocks based on the url for related content. eg: {% if 'frozen' in url|render|render %} ...
-1
votes
1answer
47 views

How can I make a multi-column content section with Paragraphs and Bootstrap?

How to adapt this code in php for Drupal 7? https://jimbir.ch/blog/making-multi-column-content-section-drupal-paragraphs-bootstrap drupal-paragraph-multi-column-field.html.twig {% for item in items %...

1
5 6
7
8 9
210