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
1
vote
2answers
1k views

Display HTML field

I am using Views Database Connector to display safe data from external database in Drupal 8 within views. Some of the fields include simple html like a list which views encodes in html entities. I am ...
3
votes
4answers
622 views

How to theme back end forms created by a custom module?

I want to be able to theme a custom form I create using a custom module that builds a form. The form is created programmatically using the code below: public function buildForm(array $form, ...
1
vote
1answer
601 views

How can I load content on the same page from a search

So the idea is to load the results of the search on the same page. I was told to look into SOLR, but it looks like we have something similar to SOLR , and we just need to know how to load new page ...
1
vote
2answers
142 views

Pass book node id as second parameter to drupal_block(“book_navigation”)?

I'm trying to use drupal_block("book_navigation") in a twig template (with the twig_tweak module installed) to display a list of chapters for a book page. But I'm getting a list of all books and their ...
-3
votes
0answers
32 views

Custom call throbber effect

Is there a way we can use throbber progress in custom call drupal 8. I am also using ajax loaded as well. $("#button").on('click', function(){ jQuery.ajax({ url: base_url + "/...
1
vote
2answers
495 views

HTML Form that Passes Information to Hidden Fields Through URL

I am trying to build an html form that is stretched across several pages. My intention is to use the GET method to send all of the fields data in the query string (URL parameters) and then store this ...
2
votes
1answer
80 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 ...
0
votes
1answer
429 views

How do I load CSS files to a custom theme?

I understand this question has been asked many times. However, I still can't figure out why the CSS files of my custom Drupal 8 theme are not loading. Edited (more info): The CSS files are not being ...
3
votes
2answers
2k views

How to add code logic to Display Suite fields without PHP in Drupal 8? Twig?

Using Display Suite in Drupal 7 I can easily add PHP logic to any custom Display Suite Field. In Drupal 8 PHP is not allowed. How can I program logic in Display Suite fields in Drupal 8? As an ...
3
votes
1answer
542 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, ...
1
vote
1answer
883 views

How do I customize node.tpl to print an entity reference field in a specific format

I have content type called collection that has an entity reference field (multiple) that references another content type called books. One the collection node page, I want to render all of the books ...
0
votes
0answers
316 views

Get user field value in Twig

I have a node--contentype.html.tiwg as well as a node--contentype--full.html.twig file in my template. In this files, I can get the nodes fields without any problem via {{ field.content.field_name.0 }}...
1
vote
1answer
629 views

How to override template for view mode of a entity within a module?

I see in theme suggestion array that I can override template for my custom entity type based on view mode like this: custom_entity__custom_entity__view_mode_name Now I want to put custom-...
0
votes
1answer
681 views

preprocess_field() not working - what am I doing wrong?

I am trying to use mytheme_preprocess_field() to alter how a field is displayed. Here is the code I added to my theme's template.php: function creative_responsive_theme_preprocess_field(&$vars) { ...
0
votes
0answers
37 views

How to go back to the store in the product template?

In the product template, I can add the code below and display the store : {{ product.stores }} How to go up in the store to display the store fields. For example, how to display the currency of the ...
3
votes
1answer
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 &$...
1
vote
1answer
494 views

Override theme function for menu callback

What I am looking for: I have a custom node link which, when clicked, displays a custom HTML content (option selections) in a lightbox. I need to pass an argument to the HTML content to generate the ...
0
votes
1answer
18 views

How to print token in webform-confirmation.html.twig?

I would like to output a submitted value as a token on the confirmation page through the twig. The token works just fine when added into the message box of webform as: [webform_submission:values:...
0
votes
1answer
63 views

How do I remove part of the HTML markup?

In my Drupal 8 template, I use {{ product.variations }} which produces the following HTML markup. <div data-drupal-selector="edit-actions" class="form-actions js-form-wrapper form-...
0
votes
1answer
512 views

Making jCarousel view responsive

Using the example on [this][1] page, I have the following jQuery code: (function ($) { Drupal.behaviors.gsdOmega4ExampleBehavior = { attach: function (context, settings) { var jcarousel = ...
0
votes
1answer
476 views

In a template, is it possible to get the content of a block by the block ID?

I am working with some view templates in Drupal 8, and I have the block ID of another view block I want to pull into the template. Is it possible to use the block ID to get the content of a block in a ...
2
votes
1answer
831 views

How to register a new PHP function in Twig?

I am trying to create a theme for Drupal 7 with Twig. If I wanted to register a new PHP function, I should implement "hook_twig_function()" as the module explains. My simple question is: where should ...
1
vote
0answers
22 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/...
1
vote
1answer
1k views

Override module javascript file in theme or custom module

Is it possible to override a single javascript file from a module within a theme or custom module? My specific use would be for Views/js/ajax_view.js - I've had to apply multiple patches to get ajax ...
0
votes
1answer
605 views

Problem rendering paragraphs field - advanced but still not working

I am working on a site with one special page layout (lets call it originally "two columns"), which has basically two columns: The left one showing page contents and the right one an unlimited number ...
2
votes
2answers
446 views

Wich template to override for user account form

I am building a theme for my Drupal 8 site and I want to create a custom profile page with user information like this: http://bootsnipp.com/snippets/featured/profile-card but I can't find the correct ...
0
votes
1answer
37 views

How to display a message according to the country of the store?

On Drupal 8, I installed Drupal Commerce 2 I want to modify the TWIG file of the products to show "Made in France", if the store country is France and made in Belgium, if the store country ...
0
votes
1answer
1k views

Theme video-embed-iframe.html.twig by content type

I am using Drupal 8 and trying to theme video-embed-iframe.html.twig by content type. with the current naming suggestions this is not possible. I am using Media with video embed field containing in ...
14
votes
2answers
10k views

How to get the human readable content type name in a node template

I have created node template for my node, and its working fine. I need to print content type name, which is like "Whitepaper" and has machine name "w1" in my node template. If I use variable {{ node....
1
vote
1answer
897 views

Block overriding with template file doesn't work

The Drupal version I'm using is v7.34. I'm using sub-theme created from Bootstrap as base theme. My problem is, I want to override the "User Login Block" and put it in the header region (top bar), so ...
-2
votes
0answers
16 views

Twig syntax error page temporarily unavilable

I have Drupal Lightning profile on site Drupal core 8.1.8. I am using efrom to add data when I click the button to add data error in recent log is Twig\Error\SyntaxError: An exception has been thrown ...
0
votes
0answers
27 views

Access 'content' or 'node' variables inside View context

I have a view where there was a file type field. So I added it to the view and rewrote the result for it: <a href="{{ field_documento }}">{{ title }}</a> The above line results ...
1
vote
0answers
9 views

Add taxonomy term description to views-view-fields--taxonomy_banner.html.twig

using taxonomy term view to render my products in Drupal 8.9 with commerce 2 . I am trying to add the term description under a banner .. but struggling to find what I need to add. new to twig,and ...
0
votes
4answers
2k views

Where do I find the block id for Twig Tweak module

In order to print a block in a twig file when using the Twig Tweak module you require the block id, but nothing I am trying will work and I get the message that - This block is broken or missing. ...
0
votes
0answers
32 views

How to generate breadcrumb title for custom routes?

I'm using a custom theme for our Drupal 8 based website, for breadcrumbs I'm using the easy breadcrumbs module. We have a custom module where the nodes are generated in a custom block dynamically. ...
1
vote
2answers
396 views

How do I change position of a “fixed” element/header to go below Admin toolbar when in Admin view?

New to JS / CSS How do I change / control the position of a sticky navigation bar to go below Admin toolbar when in Admin mode? Site uses: Subtheme of Omega / Commerce Kickstart Through subtheming,...
0
votes
1answer
839 views

How to change background image based on current node?

I am trying to change the header background image of my website based on the current node. I have added an image field to my content type, field_hero_image, and, in preprocess function ...
3
votes
1answer
71 views

Page titles are wrapped in a span tag

On a site we are working on I was asked why the page titles are wrapped with a span tag. We are not using a base theme. I checked everywhere I could think of, but came up short. In page-title.html....
1
vote
1answer
633 views

Rendering a nested Paragraph's field using Twig

We are using the Drupal 8 Paragraphs module and are have a Paragraph which contains a Paragraph type field, called "Steps" (machine name fs_steps), allowing editors to add a number of "Step" ...
0
votes
2answers
796 views

How can I rewrite the output of image field to become a div with this image as a background image?

I have a view to display a content that have an image field, and I need to display this image as a background image of a div so I can apply some CSS on it. what I tried to do is to rewrite the output ...
1
vote
1answer
812 views

Profiles-2--user-edit-page

I made my custom user-profile-edit.tpl.php using function mytheme_theme($existing, $type, $theme, $path) { $hooks['user_profile_form'] = array( // Forms always take ...
0
votes
1answer
477 views

Commerce Product Collection View Block: What Determines CSS For Each Header Link?

In Kickstart 2 there is a view called collection_products which displays a list of products in a given collection, grouped by category. There is a header which uses a Block display to give anchor ...
0
votes
1answer
534 views

How to get the managed_file progress bar working in a custom theme?

I'm trying to get the managed_file progress bar working in a custom theme. Right now, when I start an upload, the empty progress bar widget appears in the form, but it doesn't visually update while ...
0
votes
2answers
397 views

How to add custom class in body tag on form submit?

I have created custom module with custom form, in which I have added input type select. Form submission is working fine, but I wanted set select option value as custom class for BODY tag.
1
vote
1answer
355 views

Render key and value of a field

I have a field (list integer) and I would like to render its keys and values. I found field.html.twig but within I only have access to item.content which is the value. I would also like to access the ...
0
votes
0answers
25 views

Dynamic nid for drupal_field twig tweak function

I have a field_slides paragraph field on my home page, on drupal 9.1.3. It is for rendering a carousel. I want to iterate over the elements of the paragraph field (eg the slides with title, ...
1
vote
1answer
604 views

How to render / preprocess list of entity reference nodes?

I hove a content type that editors can 'attach' related nodes to. When I 'theme' / 'style' nodes of this content type through view mode everything is basically fine: the related nodes are rendered ...
0
votes
1answer
2k views

Add prefix / suffix to field by using template_preprocess_field

I remember in Drupal 7, this was possible. I need to add some HTML before a field and I don't want to edit it in the Twig file. Is it somehow possible to add prefixes / suffixes by using the ...
0
votes
0answers
14 views

Attached library not working in IE and old Edge

I've got a bit of an issue with IE11 and Old Edge 40. I've got a custom module and I've attached a library that I want to run on every page with some CSS and javascript to the module. But it seems ...
1
vote
2answers
720 views

How to set a field value from parent template in Twig?

I have node--article--teaser.html.twig which calls image-formatter.html.twig to printout the field_image. Everything works fine except that I don't want the field_image itself to be a linked. i.e ...