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

How to send html mail in drupal 8 using a module

I want to send an email to the user who forget username. I created a functionality that handle with ajax like send request to controller where I using a query to check whether user exist or not. if ...
-2
votes
0answers
23 views

Why is my custom block template not being picked up?

I am working on a custom slider programmatically. I create a custom module (block_example) and make a block (BlockExample.php) and a twig file (blockexample.html.twig) and also a module file (...
0
votes
2answers
648 views

Views: Multiple Rows & Mutliple Columns

I've been twisting and turning the View module but can't get simple tasks done. Well it should be simple but yet Drupal don't have a good solution ...yet. How to create 2 columns where column A have ...
0
votes
1answer
342 views

How do I get link the files in libraries.yml with absolute url path

In my libraries.yml files the css files are linked with the relative url paths. Eg : /css/mycss.html So when in the page source the linked url shows as relative. How do I link those files with ...
0
votes
1answer
473 views

Image Styles not creating on one custom style only

I've run into this issue where we have created a custom style (emailthumb) which is to be used when sending out email newsletters via simplenews. The thumbnail is based on 'thumbnail' style but is ...
0
votes
0answers
24 views

Content translation not working on the front page

I have a translation problem on my site in drupal 9.1.3. I have a content type for my homepage that contains two fields: field_slides which is an EntiyReferenceRevisionFieldItemList to a Paragraphs ...
0
votes
0answers
14 views

Set background picture only within the text field, not the entire page

How should I make the background image appear within the text field (in the Basic page content type) but not the entire page? I am using the Background Image Formatter module, running on Drupal 7 with ...
-1
votes
0answers
20 views

How to add multiple languages for hreflang

I'm trying to add multiple hreflang's for my drupal site using the following: $attachments['#attached']['html_head_link'][3] = array( '0'=> array( 'rel' => 'alternate', 'hreflang' =>...
0
votes
1answer
19 views

Render link in twig with 'entity:node/n' as uri in array

With the module "config pages" I've set some variables global to render in templates. In mytheme.theme I've added a function: function mytheme_preprocess(array &$variables, $hook) { $...
0
votes
2answers
511 views

Default user image in user account menu!

I am trying to add a default image to render in the user account menu when the user does not have an image. CODE: function nestle_preprocess_menu(&$variables) { if($variables['menu_name'] == "...
7
votes
2answers
5k views

How do I theme a taxonomy term page?

I am working on Drupal 8, trying to get a page template for each vocabulary. I have tried using hook_theme_suggestions_HOOK_alter() to achieve this, but I was not able to do it. I tried using Devel ...
3
votes
1answer
514 views

How to get node url/address from entity reference (content type)?

Is there a way to fetch or print the node url/address from a entity reference to my twig template. I have already tried {{ related_links.entity.uri }}, {{ related_links.entity.url }} or {{ ...
0
votes
0answers
31 views

How to “copy” in HTML? [closed]

I have a site with Drupal 8 and I want to do a "copy" text with a button in TWIG. How can I do this ? I need to make a copy to two different place on the same page : <div> <small ...
1
vote
1answer
5k views

Create a form programmatically and display result on template

I'm trying to create a simple page with a form. With the different filled fields I want to execute different EntityFieldQuery in the HOOK_form_submit. To finish I want to display the result of ...
1
vote
1answer
47 views

How to put the Bootswatch theme locally?

I am using this sub-theme and I can't find any help. bootstrap-barrio-installation barrio-starter-kit I am currently using Bootswatch Flatly in CDN mode. I want to put everything locally. Here is ...
0
votes
0answers
19 views
+50

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 ...
0
votes
1answer
26 views

How to know a page whether has a class named 'test' element in drupal?

In my develop process, I meet a scenario: I only want to load a js file when a page has an element whoes class is 'test', so what can I do? How to know a page whether has this element?
-1
votes
0answers
23 views

Parent store URL is not working

I am having problems since the last update of Drupal Commerce to version 2.23 At the top of my products page, there is an area with the parent store. This area is a link to the parent store. Before ...
-2
votes
0answers
24 views

How to remove duplicate title from product variations? [closed]

On my product page, I already have the title su prosuit. When I select a variation, the title is repeated again and i is completely unnecessary. It should be removed for a better user experience. How ...
0
votes
2answers
2k views

Modify “head-placeholder” in html.html.twig

that's the first time I approach to Drupal or a CMS more generally but I've been working since years as FE dev. I'm creating a theme based on a template created from scratch for the Italian Public ...
2
votes
2answers
1k views

How can I apply different templates based on taxonomy hierarchy?

I'm new to Drupal and I don't have extensive knowledge so I'm hoping I can get this question answered. I want the taxonomy pages of lower hierarchy to be displayed differently from the higher by ...
2
votes
0answers
20 views

How do I test for an empty Address webform element?

Using Drupal 9.1.3 : Webform 6.0.0 I have 4 composite address elements in a webform that may or may not be filled, depending on the user's other selections within the form. I can use the default email ...
-2
votes
0answers
32 views

Adding a for loop

I would need a small help to get the output by adding the for loop. I have a view which has a image field. And I would like to theme it, I have created two view templates called "views-view-list--...
2
votes
1answer
681 views

Theme template.php functions after bootstrap

I'm trying to print a drupal menu outside drupal. In order to achieve this I ran the bootstrap as follows: drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); And I render my menu as follows: public static ...
2
votes
2answers
9k views

How to access session in twig?

I wondering how to access to session in twig ? In my Controller I have this part of code : $tempstore = \Drupal::service('user.private_tempstore')->get('mdm_user'); $tempstore->set('...
0
votes
1answer
1k views

How can I get the module path in twig?

I have a module and created twig templates there. I just followed the documentation here: https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-for-custom-module I want to include a ...
0
votes
1answer
619 views

Insert a collapsible fieldset or region in a panels layout

I created a custom layout for a panels display and I would like to have a region or multiple regions in my custom layout be collapsible with javascript/jquery. Ideally the state of the collapible ...
0
votes
1answer
656 views

Theme file upload form element

I want to theme all the file upload fields on my site but I don't know how to name the template file. I want to alter the form-element.html.twig file but as I have multiple file fields I don't think ...
0
votes
1answer
26 views

Page title and body field of specific page

I have a page--front.html.twig file. I can't figure out how to show a specific node title and body summary on the frontpage with only using twig. I know I can create a view of something like that and ...
2
votes
1answer
3k views

How can I specify inner elements template in custom login page?

I am new in Drupal 8. I want to create a new theme to according to my HTML. What is the best practice to integrating a custom build theme to drupal engine. I have covered all sections in Drupal 8 ...
1
vote
1answer
734 views

Passing variables to JS from theme folder .tpl files

I use many template files in my modules via hook theme. In order to pass variable to JS files I use the method described here: https://www.drupal.org/node/304258 in the .tpl.php files: $my_settings = ...
0
votes
1answer
15 views

I cannot sign into my drupal site. The login page just refreshes and there are no error messages

I cannot login into any account from the login page. I can get to the admin page by doing drush user-login but if I log out of admin and try logging in again, the login page just refreshes and I do ...
0
votes
2answers
1k views

How to set body content using preprocess_node?

I need to alter the body html for a specific content type which will be processed by the Pagination module. I think preprocess_node will work, but I'm having trouble figuring out how to change the ...
0
votes
1answer
14 views

CSS problems styling the search box block created by Search API Pages module

I'm using Search API and Search API Pages on Drupal 9 and I'm trying to style the Search API Pages search block. The problem is that when placed anywhere but bottom in the sidebar, the search block ...
-1
votes
0answers
17 views

Custom Slider Programmatically [closed]

I am new on drupal and working with drupal-8. currently, I start working on custom module. I want to make a custom slider programmatically for my practice. but I don't know how should I start. I ...
1
vote
1answer
620 views

Block Settings not applying to Zen sub theme

I've created a Zen sub theme using the Starter Kit enabled it, and set it as the default (I've changed very little from the Starter Kit). If I go to Structure > Blocks there is only a tab for the Zen ...
1
vote
2answers
4k views

Pass variables from controller to existing node template file

In the Drupal 8 documentation I have found a way how to pass variable from controller to custom twig template https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-from-custom-...
0
votes
1answer
15 views

Moved Site - Can't find original CSS for look other than in the ADVAGG

I've inherited a drupal 7(I'm a beginner) site that had ADVagg installed. I added a stanza in my nginx config to take care of those files. What I'm running into is that there is a button on the ...
0
votes
2answers
341 views

Print password confirm field in user register template file

I'm trying to theme the user registration form in Drupal 8. I have defined a custom template for user registration form and printing the fields with the following code. {{ form.field_profile_title }} ...
0
votes
1answer
29 views

How can I add Commerce Wishlist share mail template variables from form?

I am trying to add 2 additional form fields to the Wishlist Share form where the user input will be rendered in the email. I have been able to add the fields to the form, but I am not sure how to add ...
1
vote
1answer
29 views

how to create template suggestion for image like image--NODE-TYPE--VIEW-MODE

I'm trying to create a suggestion like image--NODE-TYPE--VIEW-MODE, but in mytheme_theme_suggestions_image_alter() $vars i haven't node related info thanks for help
9
votes
5answers
12k views

How can I count a multivalue field's values in twig?

I want to count the number of values of unlimited field in twig tempalate I tried {{ node.field_mytext.count }} => faced with error and in another try {{ content.field_mytext.count }} => nothing ...
2
votes
1answer
418 views

How can I load CSS files located outside the web root from within a custom module?

I need to store my css files at a location outside Drupal's path (e.g. /srv/assets/css/my_site/general.css). I attempt to achieve this using drupal_add_css but the browser loads them from: http://www....
0
votes
3answers
772 views

How do I theme the contact form?

I am trying to create a contact form for users with username, email, message, and submission button, but I want to customize the structure of the form. Where do I get the structure of the form to ...
1
vote
1answer
2k views

How do I get navigation menu on top with narrow viewport?

I'm running Drupal 7.28 with Zen 7.x-5.5. In the default setup, there is a region on the right side named "First sidebar" which contains a block named "Navigation". I have put my navigation links ...
1
vote
1answer
1k views

jQuery dialog is duplicated when set on a form that uses AJAX

Im using jQuery dialog on my form. Drupal.behaviors.custom = { attach: function (context, settings) { $('.form-container').once('form-cont', function () { Drupal.custom.modalLinks(); })...
0
votes
1answer
1k views

Getting values on twig node template

I have installed ECK module in my website. Using it I have created a "report eck" entity in which I have different bundles like section, notes, etc., each containing different fields. I have my ...
0
votes
0answers
5 views

Access custom block link field url in twig template

I have a custom block with four fields like this : I want to display in twig the value of image's uri. I've tried something like that in field--block-content--field-linkedin-link--rs.html.twig ...
-2
votes
1answer
33 views

Is there a way to sort view asc or desc using twig

Is there a way to sort view asc or desc using drupal_view('vn', 'vmn', sort order) in twig or Can sort we views_embed_view() in controller
0
votes
2answers
358 views

theme_debug doesn't work

I wrote into my settings.php file (into default.settings.php file too): $conf['theme_debug'] = TRUE; $settings['theme_debug'] = TRUE; $settings['theme_auto_reload'] = TRUE; (These files have 777 ...

1
2 3 4 5
209