Skip to main content

Questions tagged [theming]

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

2,501 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10 votes
1 answer
2k views

How do I theme a modal popup?

How can I style Drupal 8 modal window to achieve Instagram style and behaviour? I'm creating modal through extending ControllerBase class, thus have full control of content. However I can't figure it ...
Jonas's user avatar
  • 101
5 votes
2 answers
4k views

How to pass a field value as contextual filter argument using Twig Tweak drupal_view?

In Drupal 8, I'm using Twig Tweak to embed a view. I have a contextual filter set to one of the node's fields, field_project_id. If I use a literal for the third argument, it works. If I try to ...
timwilson's user avatar
5 votes
3 answers
2k views

How to only display languages in language switcher block where a translation exists?

I need to enable thousands of languages on my Drupal 7 site, but I do not want to incur the rendering overhead of creating the language switcher sidebar for every language. The default behavior for ...
cyboreal's user avatar
4 votes
0 answers
191 views

Can't make sense of the CSS loading order

I want bootstrap.css to load first, because it's breaking all of my styles. Yet, no matter what settings I use in my module, it always loads last. Every CSS file from a library in my theme loads ...
RaisinBranCrunch's user avatar
4 votes
1 answer
402 views

Twig cache files on load-balanced setup

The Twig cache key (twig_cache_prefix) is based the modify timestamp of the Twig template file and a randomly generated key. This gives a problem with a load-balanced Drupal setup where every host has ...
Lennert's user avatar
  • 49
4 votes
1 answer
133 views

Can composer-dependent PHP libraries be used with the Libraries API?

I'm trying to include a PHP library called Geocod.io in my custom module. I am also trying to use the Libraries API. So far I have: Downloaded geocod.io to sites/all/libraries composer install'ed in ...
beth's user avatar
  • 9,087
4 votes
3 answers
1k views

Get field_collection values in field template

I have installed field_collection and have a collection called field_contact, each entry of which has a field called field_contact_url I'm trying to customise the display of that field by overriding ...
ChrisJ's user avatar
  • 203
4 votes
2 answers
2k views

Adding new rows on a draggable table via jquery

I have a draggable table with preloaded "new items" - sorta like the Power Edit feature of the menu_editor module. Everything works perfect. However, I want to have a button that adds a new row via ...
Bibokid's user avatar
  • 325
4 votes
1 answer
224 views

Why Calling the theme path in a multinlingual site adds a language prefix?

In my template whenever I call the path to my theme in a particular language it adds a language suffix dir like mysite.com/fr/sites/all/themes/mytheme while I'm expecting a path without a prefix (e.g. ...
rcampistron's user avatar
3 votes
1 answer
2k views

Site errors out when trying to create a subtheme based on Classy

I'm creating a custom theme in Drupal 9 and am trying to use classy as my subtheme but get the following error: The website encountered an unexpected error. Please try again later. Drupal\Core\Theme\...
ACanadianCoder's user avatar
3 votes
0 answers
162 views

Differences in adding classes to nodes and paragraphs

I'm trying to add some classes to a certain content type. In mytheme_preprocess_node_contentype() I'm able to use $variables['attributes']->addClass('myclass') However, in ...
Vecta's user avatar
  • 603
3 votes
0 answers
3k views

How to preload generated styles and scripts?

I'm trying to preload my main css and js files - these files are generated using the AdvAgg module. I've tried using the hook_preprocess_html in a theme and in a module, but in the $variables['page'][...
BrynJ's user avatar
  • 131
3 votes
1 answer
173 views

How do I capture a page as HTML?

I have a controller that generates a custom 500 page. I have set up a route at the path: '/500'. I would like to capture this as HTML and save as a static file, so that I don't need to bootstrap ...
oknate's user avatar
  • 14.4k
3 votes
0 answers
146 views

Template name suggestion for multivalue image field in paragraph module?

How can I create a dedicated template name suggestion for paragraphs multi value image field? The below HTML comments are the theme hook suggestions added by the debug function, for the paragraph ...
Mojtaba Reyhani's user avatar
3 votes
1 answer
239 views

How to render a @FormElement in Views area plugin

I am doing a custom plugin area for displaying some data in a views footer (Drupal 8). I do something about just like this : Create a custom area plugin The only point is, instead of #markup in the ...
Dom.'s user avatar
  • 31
3 votes
0 answers
668 views

How do I use the current theme templates to render a node in a module in order to send node content via email?

I'm trying to send a rendered node (which contains multiple entity references) via email for a newsletter. I'm using workbench moderation and workbench email to manage the different states I need and ...
Julien FRATICELLI's user avatar
3 votes
1 answer
144 views

Display comments according to the users roles

I try to create various tabs for my nodes, which show a specific field and the comments of the users according to their roles : I would like that these tabs are pages, and not in Javascript tabs. ...
Hgfdsoiu's user avatar
  • 411
3 votes
1 answer
115 views

"Initial Menu Level" config in Block Layout not working

Using Drupal 8... Goal There are 2 regions in the header. The top region holds the Level 1 menu links while the bottom region holds the Level 2 menu links (or child links of the top regions). What ...
Chayemor's user avatar
  • 281
3 votes
1 answer
1k views

Override form.html.twig into module

i need to override a form.html.twig in my custom module. i used hook_theme_suggestions_alter in my .theme file to add new suggestions. function MY_THEME_theme_suggestions_alter(array &$...
user avatar
3 votes
0 answers
2k views

Trying to set a twig global variable for a function

I have a Twig function in my theme that sets a random ID. The function works well if I include the entire function within any given template and then render the variable for that {{ randomID }} in the ...
Danny Englander's user avatar
3 votes
0 answers
732 views

Theming links in blocks using twig templates

I have a block for the language switcher. I want to override the links in it. I can override a specific language switcher block's markup, and I can override the links markup in all language switcher ...
NikLP's user avatar
  • 1,023
3 votes
0 answers
2k views

What Twig variable can i use to view Page Title or Taxonomy Name for a Taxonomy Type page

In Drupal 8 I need a way to get the Current pages title or Taxonomy name/ID. In the template taxonomy-term.html.twig the variable works: {{ term.id }} I need the variable to work in page.html.twig ...
blu's user avatar
  • 448
3 votes
2 answers
508 views

Change icon class in "Add to cart" button

I am using Drupal 7, Ubercart, and Bootstrap. The default Add to cart button looks like this: <button id="edit-submit-270" class="node-add-to-cart btn btn-success form-submit" value="Add to cart" ...
alexin's user avatar
  • 153
3 votes
1 answer
288 views

Why is 'render element' sometime 'element' and sometime 'elements'?

I notice in Drupal source code, in core modules hook_theme(), some places are 'render element' => 'element' and some places are 'render element' => 'elements' (plural). Why? Even the render ...
Minh Kiet's user avatar
  • 171
3 votes
0 answers
2k views

8 - Firefox loads JS before CSS, causing flash of unstyled content

My Drupal 8 site will load fine in Chrome and IE, because they both load my CSS before my JS when I look at the Network tab in the console. But when on Firefox, it will load the JS before the CSS. ...
David C's user avatar
  • 221
3 votes
2 answers
591 views

How to remove markup from file field

I have added a file field in views and when displaying it has some markup like this <div id="file-218" class="file file-image file-image-jpeg contextual-links-region"> <a href="#"> ...
Nabil's user avatar
  • 341
3 votes
2 answers
747 views

Link tags in template file auto closing.

I’m having an issue wrapping a link around some output in a template file. I have the right template file; and I can put text like ‘start here’ and ‘end here’ and it prints out where I want the ‘a ...
Deejay's user avatar
  • 670
3 votes
1 answer
322 views

How can can I get theme callback to work for an error page?

I've created a custom error handler for 404 errors (page not found). I've set up Home » Administration » Configuration » System » Error Pages for 404 errors to point to http://example.com/...
Free Radical's user avatar
  • 15.1k
3 votes
0 answers
2k views

How to update a library through drush or git url? what about update chosen library?

I am new with Drush and git... previously I use to work with Ftp so at the moment I would like to know How I can update a common library by using drush or by using git (library url). I know that in ...
Liz's user avatar
  • 63
3 votes
0 answers
190 views

Disable form altering for admin pages on Bootstrap 3

My default theme is Bootstrap but I use Shiny theme as admin theme. Bootstrap theme alters the forms and fields. And I use Hierarchical Select module, there is a dropbox for multiselection and the ...
Metin Gül's user avatar
3 votes
2 answers
256 views

What to name field collection theme file?

There are several articles here that address theming field collections but none that specifically cover the naming conventions required to actually get them recognized by Drupal. field--field-field-...
Bill Dawson's user avatar
3 votes
1 answer
157 views

Override and add a link to a themed table

Using a custom module, I'm trying to add "Schedule" links to each of the rows of the table on node/%nid/revisions, but can't seem to figure it out. Do I have to override the entire function ...
gmclelland's user avatar
3 votes
1 answer
225 views

Removing the active language

I'm having some trouble with removing the active language from the Language Switcher Dropdown module. I'm trying to override theme_languageicons_icon() with the following code, but it doesn't seem to ...
Joe Micallef's user avatar
3 votes
1 answer
586 views

Views Grouping field:Add Ordered class to Grouping row

I use Views and Grouping field to integrate my data. But i need each grouping row ordered. I want to override the views-view-grouping.tpl.php, and change the "view-grouping" class to "view-grouping-1"...
cobenash's user avatar
  • 632
3 votes
1 answer
563 views

When reimplementing Drupal.tableDrag.prototype.dropRow(), how do I access classes of would-be parent?

Using code below, I can access classes of a row that's being dropped: Drupal.tableDrag.prototype._dropRow = Drupal.tableDrag.prototype.dropRow; Drupal.tableDrag.prototype.dropRow = function(event, ...
Mołot's user avatar
  • 21.9k
3 votes
0 answers
271 views

In tabledrag form, how to prevent certain elements from having children?

I want to use tabledrag to manage 2 kinds of elements. Let's call them branches and leaves. Branch can be parent to both branches and leaves. Leaf cannot be parent to anything. A support for class ...
Mołot's user avatar
  • 21.9k
3 votes
1 answer
356 views

Move drag and drop handle to other side

I want to move the drag and drop handle to the other side of a form, to the same location as the row weight selections. I am talking about the tabledrag handles, as shown below: I am using ...
rborgeous's user avatar
  • 131
3 votes
2 answers
303 views

drupal_find_theme_functions called on every page - is our theme registry being rebuilt?

Our new D7 site was running very slowly so I did some profiling with devel/xhprof and found that D7 was doing millions of preg_grep function calls within drupal_find_theme_functions() in theme.inc. ...
Oscar Sodani's user avatar
3 votes
2 answers
78 views

Formatting with Views

So I'm using the Views module to list inventory items that include: Name Photo Description Sales document I noticed that each item in the view is formatted differently because of size of text, image,...
Cory Kitchens's user avatar
3 votes
1 answer
454 views

Select an Image style depending on external/dynamic factors (theme region or other field content)

I have a Bean (bundle that generates blocks) which I display in one of 2 different theme regions. Either in the header, or the footer. This Bean contains an Imagefield, which is rendered through an ...
Tom Kirkpatrick's user avatar
3 votes
1 answer
758 views

How can I theme field collection forms?

I have a field_field_collection in content type (used to field collection module and have unlimited value). It has a number of fields as in the picture below: And I want customize theme for it as ...
Lê Quang Tú's user avatar
2 votes
0 answers
231 views

Equal-width columns in Olivero

I display an entity reference field that holds 4 images (media items). By default they are displayed in 4 rows one below the other. I want to display them side by side. Olivero is the theme I am using....
Foti Dim's user avatar
  • 153
2 votes
0 answers
49 views

How do I access current_page value in views twig template?

In views-view.html.twig, I'm trying pager['#views_plugin'].current_page, but don't get any value.
Trudog's user avatar
  • 41
2 votes
0 answers
537 views

How to get content url in views-view-unformatted block template

In Drupal 8, I created template for solr search view views-view-unformatted--solr_search_content--block.html.twig I am trying to print the content link by {{ row.content['#view'].style_plugin....
Ramalingam Perumal's user avatar
2 votes
0 answers
245 views

Theming a file link by adding custom file name suggestions

I want to display a bunch of data inside a view table, where each dataset has up to three different files. The user should be able to download these files by clicking a custom button or image in this ...
mtnair's user avatar
  • 63
2 votes
0 answers
104 views

How do I change layout?

A disclaimer first: I am a professional medievalist, not a programmer or a front-ender. I have some front-end knowledge, but not a lot. So, please, be easy on me. Now, I am customizing a Bootstrap 4 ...
Jables89's user avatar
2 votes
1 answer
531 views

Best practice: Twig logic versus Preprocess functions

I use Twig and Twig Tweak to do most of the processing. However, from time to time I need to rely on Preprocess functions to get the desired result. This led me to a situation where now most of my ...
timson's user avatar
  • 48
2 votes
1 answer
490 views

jquery.ui libraries-override > Incomplete library definition

I tried to remove the core jquery.ui theme.css by writing into mytheme.libraries.yml the following lines. libraries-override: core/jquery.ui: css: theme: assets/vendor/jquery.ui/...
3119999's user avatar
  • 21
2 votes
0 answers
132 views

How do I test for an empty Address webform element?

Using Drupal 9.1.3 : Webform 6.0.0 How to check for the null value of a Webform Address Composite element {% if webform_token('[webform_submission:values:**ELEMENT_NAME**]', webform_submission, [], ...
David Barrett's user avatar
2 votes
0 answers
98 views

How to add conditional on Gutenberg's color theme-support?

I've added the Gutenberg theme-support on my custom theme. I want to add conditional based on text color and background color. For example, selecting the black color background will reset the default ...
CocoSkin's user avatar
  • 891

1
2 3 4 5
51