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
4 views

How to change the view for a rendered product?

I'm learning Drupal Commerce with a Commerce Kickstart installation. I understood in part the way products are displayed, with variation types and content types. Have made some changes like visible/...
0
votes
0answers
9 views

Admin toolbar CSS broken by theme

I'm facing issue with Admin toolbar. Every time I create theme and define default style guide for typography eg.: ... h2 { font-size: 3rem; } p { font-size: 1.2rem; } ... Admin toolbar's CSS is ...
-3
votes
0answers
21 views

How can I call my Controller methods from Javascript in Twig [closed]

This Is Twig File - <div class="tab" style="border-bottom:1px solid black"> <button class="tablinks" id="Personal-Details" onclick="personalDetails()">Personal Details</...
0
votes
0answers
16 views

Hide view's elements onfirst load, show them on filter click and reset it again by general data filter

Edit As my first question I made some mistakes, so I'm trying to keep it more clear and useful for other people. The scenario: I built a View showing nodes and contextual filters to have taxonomy ...
-2
votes
0answers
25 views

Updating 7 to 8, how to remove .less / scss files

I am updating a website from Drupal 7 to Drupal 8 and suddenly I see all these .less files influencing the style of the page. I found them in the theme's /srss directory (mytheme/srss/bootstrap/) ...
0
votes
1answer
26 views

Unable to retrieve checkbox values from a template file

I have created a checkbox option for a field. Category One Two Three Four This is the code I am using. {% for key, item in content.field_room_category if key|first != '#' %} <li>...
0
votes
0answers
15 views

Variable in file-audio.html.twig

I created the following preprocess function to add a value. function mytheme_preprocess_node__audio(&$variables) { $node = $variables['node']; $media_field = $node->get('field_image')->...
0
votes
1answer
21 views

How do I prevent the HTML markup in an item list from being escaped?

As you can see in the code below, I try various ways to prevent Drupal from escaping the HTML and passing the link tags to the output, including the use of '#allowed_tags' and the Markup class. None ...
0
votes
0answers
15 views

reformat webform radio button

Using Drupal 7 webform, the standard radio button output is as follows: <div class="form-item form-type-radio form-item-submitted-X"> <input type="radio" id="edit-submitted-X" name="...
0
votes
0answers
20 views

How to optimize the Glyphicons font with font-display: swap?

I want to optimize the loading of the Glyphicons font for the Google PageSpeed Insights tool. I need to apply the CSS code below : font-display: swap Here is the location of my font : https://...
0
votes
0answers
34 views

Is a block render array built with EntityViewBuilderInterface::view supposed to render full block template or only inner fields?

After rendering custom blocks in templates, I got this js error: Quick Edit could not associate the rendered entity field markup. What I've done so far : In order to render repeatedly custom blocks ...
0
votes
1answer
31 views

How to embed HTML and CSS in a custom form element?

This worked in Drupal 7 but isn't in Drupal 8. $form['covid-19'] = array( '#markup' => '<div style="border: 2px solid red;padding:10px;margin-bottom:10px;"><strong>Due to the COVID-...
0
votes
1answer
30 views

Sub-theme adding prefix to all block machine names

On my site, I have created a sub-theme of a sub-theme using this as a guide to set this up https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme and it ...
0
votes
1answer
19 views

Upgrading to Drupal 8, custom theme not using referenced CSS file [closed]

I am upgrading a theme from Drupal 7 to Drupal 8. I reference .css files in mytheme.library.yml that do not seem to be getting pulled into the site. I've looked online and even copied sample coding ...
0
votes
0answers
33 views

Print a taxonomy term and url D8 views template

I am totally new to drupal 8. I have used d7 and i am migrating now. I have setup a view with 4 articles. I have managed to print out in a custom views theme my title image url {% for row in ...
-1
votes
0answers
24 views

image not showing on some pages with same src [closed]

I have a custom block where I have displayed an image. it's working nicely on all pages except login and registration page. On the login page when I inspect element and add "/" in scr before the image ...
0
votes
0answers
25 views

getUrlObject() returning empty proto object

I'm trying to follow this post to turn my menu tree into an array I can more easily work with. When I run my code and look at $filteredArray I get: title: *Name here* url_obj: {} has_children: true ...
0
votes
1answer
13 views

How can I render an image stocked in a custom module with an image style?

I'am learning Drupal 8, and I would like create a custom module who create a block to add share button. The link of this button should be an image who stocked in my custom module. I would like use an ...
2
votes
1answer
43 views

What is the difference between renderPlain and renderRoot?

I added a login form to a node with following code : function my_theme_preprocess_node(&$variables) { $node = $variables['node']; $variables['login_form'] = FALSE; $variables['username'] = ...
0
votes
1answer
20 views

Using variation values in a template file

I am building a site that uses Drupal Commerce 2 and I am attempting to build out the product details template. Our product has a variation (field_accessories) which is an entity reference to another ...
0
votes
1answer
24 views

How do I conditionally add a class to my page title within page-title.html.twig?

I have a boolean field within my Page content type called Hide Title. I need to conditionally add a class to h1's to visually hide them if this field is checked. I have the following within page-...
0
votes
0answers
25 views

Setting Views contextual filter values dynamically with Twig in Webform

I am attempting to embed a view in a webform whose contextual filter value is set based on a user selection. I have created a view of nodes with a contextual filter, and a webform with a select ...
0
votes
0answers
38 views

Access a page.html.twig template variable in another twig template using a preprocess function

Drupal core 8.8.3 Version Using a preprocessor function as below function subtheme_bs_preprocess_book_tree(&$variables) { $variables['page_id'] = code here to read the node.nid variable ...
0
votes
2answers
35 views

Geting values for multipart form elements using Twig

Whereever you are, I hope you're fairing well under the circumstances. To some of the hardest hit areas, we are thinking of you constantly. Webform Advanced Elements I am having difficulty ...
-1
votes
0answers
17 views

Theming responsive and off-canvas menu [closed]

I need help to theme mmenu (librarie) items and item from responsive_menu module. I use drupal 8.8.3 and Responsive and off-canvas menu 8.x-2.6 with mmenu v7 When I change my css no change, but I ...
0
votes
0answers
9 views

How to change librarie's css from xxx.theme or hooks

I want to alter the path of the css of the mmenu library (jquery.mmenu.css and jquery.mmnenu.all.css) which are in (/libraries/mmenu/dist/jquery.mmenu.css and / libraries / mmenu / dist /jquery.mmenu....
0
votes
0answers
22 views

Strange behaviour in twig template

I am trying to render image in custom field.html.twig template but following snippet not working: {% for item in items %} {% if not loop.first %} <div class="image-gallery-image"&...
0
votes
1answer
8 views

how to create custom template for a product type in drupal 8 commerce

I want to have separate twig templates for each product type in drupal 8 commerce to customize them. is there any way to do that?
0
votes
0answers
44 views

Date range issues with timezones in twig

We're using date ranges for some events in an application. We're finding that when we use the date value and end_value independent of one another then the timezone is incorrect. For example, inside a ...
0
votes
0answers
13 views

Hiding the next page button in Webform after required question is completed

I am designing a webform (Drupal 8 webform 8.x-5.8) to serve questionnaires to patients and to ease the patients load of filling in questionnaires I would like to automatically advance the webform to ...
0
votes
1answer
61 views

Use page.html.twig template variable in another twig template

How do I call a page.html.twig template variable from the book-tree.html.twig template. Using kint, I have found the variable, nid as in the screenshot below: The 'nid' is highlighted, but it is the ...
0
votes
1answer
27 views

Extract email addresses from composite field type using Computed Twig

I am using a custom composite field type to gather multiple pieces of data from a user. This custom composite field type contains a field which gathers the email addresses entered. What I am trying ...
2
votes
1answer
49 views

Why is libraries-override not removing assets?

My attempt to remove CSS and JS assets is not working. I have placed the following declarations in my module's *.info.yml file. But after clearing the cache, I still see the assets in the head of ...
0
votes
1answer
23 views

Basic page template

I am using Drupal 7 to create a page and a custom template for that page. I created a page from Content >> Add Content >> Page. In my theme /template folder I have created a file called page--my-...
0
votes
0answers
21 views

Spacing with inline links in TranslatableMarkup

I have a TranslatableMarkup string that has a link that is inserted in it as a variable. However this link comes without a space between the link and the previous word in the string. $message = new ...
0
votes
1answer
25 views

Load id of paragraph in hook_preprocess_layout using load($id) method

I want to load the paragraph id in theme preprocess. function theme_preprocess_layout(&$variables) { $ID = $variables['content']['#paragraph'] ???; "contents - protected 'id' => array(1) = ...
0
votes
3answers
45 views

Override templates for one view page or block

I am trying to figure out if there is a way to override the base templates for one view. I created a page with a view called 'Promotions'. I need to override the views-view-field.html.twig, views-view-...
0
votes
0answers
29 views

Issue with Access PHP array in display module

I am trying to use result['data'] to new custom module. fgsis theme and all are custom template and modules. I have module fgs_api.module where I have function which returns results->data and get ...
-3
votes
0answers
17 views

How to create filters for product fields in Ubercart?

I have installed ubercart module in drupal 8. I want to display filters on ubercart catalog page. Please help me How to add filters on ubercart catalog page.
0
votes
0answers
19 views

How do I create a template to display view fields [duplicate]

I created a view and added it as a block. Now what I want to do is to manage the way the fields are displayed. However, when I inspect the page, twig doesn't show me a template name that I can use to ...
-1
votes
0answers
46 views

Ajax submit form data to controller and update content in twig template

EDIT: My first code example had some faults.. I believe that I now have a module of a working non Ajax Form. - Any help pointing me in the right direction to submit and update the output with ajax is ...
0
votes
2answers
41 views

Can I somehow edit libraries.yml files from the backend using the admin panel?

In my Drupal project, we load custom CSS for some of our specific pages. Right now I do all of these modifications programmatically. But what our manager wants is to create it manually in the admin ...
0
votes
1answer
33 views

How to display an alternative text if the comments are closed for the node?

in my node type template, how do I display alternate text if comments are closed for the node ? {% if content.comment %} <div class="card mb-5 p-3 shadow"> {{ content.comment }} ...
0
votes
0answers
65 views

Can IMG URI be displayed in image.html.twig?

I want to include Magnific Popup in my site. The only thing that left to do is display the URL of the image in link wrapping the image field. I saw that image.html.twig modify the image of my ...
0
votes
0answers
16 views

managed_file FormElement submitting form upon file upload

How do i prevent managed_file(Browse Button) from calling submitForm function upon uploading file? I've added '#attributes' => [ 'submit' => FALSE, 'onclick' => 'return false' ] to no ...
0
votes
1answer
25 views

Place the footer AND the copyright blocks at the bottom of the page responsive [closed]

I installed Industrial Theme from Zymphonies and I am struggling to place the footer and the copyright (2 block layouts) at the bottom of the page. So, on my website it looks like that. I tried a ...
0
votes
0answers
46 views

Set display options for a json string in drupal 8 BaseFieldDefinition:

I have a field that stores a json string with keys and values in the database. I wish to format this output from my field definition display option to output the json string as a list. Is it possible ...
-2
votes
1answer
45 views

CSS not work after applying ajax

I have a problem with css after applying ajax. I have an exposed form that I stylized. Before applying ajax it is: id="edit-field-price-value-min" After applying it changed to id="edit-field-price-...
-2
votes
0answers
26 views

Fractionslider not working on custom theme

My problem with this module is that fractionslider is not work on my site. Slider work on views configuration site "admin/structure/views/view" in preview section but not on site in my custom theme. ...
0
votes
0answers
25 views

Apply a theme to a custom field

I have a custom field with formatter which is currently outputting via field.html.twig I've modified the theme function to function mymodule_theme() { return [ '...

1
2 3 4 5
206