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
1answer
28 views

How to make node edit form meta panel accordions default to closed?

When editing a node the meta panel fieldset accordions default to being open if they contain data. I understand why this has been done, but I think it makes for a very noisy and potentially confusing ...
0
votes
1answer
46 views

Removing line breaks in Twig

My twig file is adding line breaks in the HTML which results in white spaces, as shown in this picture: In the browser inspector: When I remove the line breaks in the inspector, the white spaces ...
-1
votes
0answers
19 views

Manage the content navigation bar [closed]

On my site I have just developed a fullscreen popup which contains 2 buttons depending on which button the user is going to click, I should display the link in my navbar. How can I get the value of my ...
1
vote
1answer
37 views

Attaching Theme Library to Custom Module

I have a subtheme called bootstrap_subtheme. It has a library called global-styling. I created a custom module called telephone_alter. In telephone_alter.module, I have the following: function ...
0
votes
1answer
31 views

How to get the entity ID in a twig template

I have a custom entity, with the template my-custom-entity--my-entity.html.twig. How do I access the ID in the template? I can do this by implementing hook_preprocess_entity, but am wondering if the ...
-1
votes
0answers
32 views

Getting values from checkbox in foreach loop form [closed]

Im building a custom module, this module is getting data from values in db, i have created the form using this way: $data = []; foreach ($nodes as $node) { $getData = \Drupal\node\Entity\...
0
votes
1answer
14 views

Check if the user has flagged content with any flag

It is possible with the following code to check if a content has been flagged by the current user with a certain flag: $flag = flag_get_flag('flag_name'); if ($flag && $flag->is_flagged($...
0
votes
0answers
42 views

Change placement of 'Read more' link in a teaser

I have a view where the content is displayed as teasers on the page. There is a 'Read more' link that is displayed above the body text for each teaser (refer to the screenshot below, circled in red), ...
0
votes
1answer
31 views

User edit form on custom page is resetting roles when user belongs to the “Administrator role”

I'm trying to display the user edit form on a custom page with limited fields. Submitting my form works well, but if I have the Administrator role, roles are reset. I don't understand why this is ...
-3
votes
0answers
55 views

Hi, I am created the custom form module and twig template.. but form doesnt render on page.. I am paste my code here.. please help me [closed]

Form <?php namespace Drupal\proposerdetails\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; /** * * {@inheritdoc} * */ class ProposerDetailsForm extends ...
0
votes
1answer
42 views

Generic field.html.twig template for a custom Entity

I have a custom Entity called custom_entity, along with a custom module which provides twig templates for my bundles and their fields. How can I define a generic/base field template for all fields ...
-2
votes
0answers
17 views

How to set equal height to drupal blocks [closed]

I am using bootstrap theme with D8. I have 4 blocks. Each row should have 2 blocks. Below shows code for one block. Rest of the blocks have identical code except for the characters. If all the blocks ...
-1
votes
0answers
59 views

Layout Builder and field_collection issue

I migrated all my field_collection content to the paragraph module without any issues, but Layout builder seems to be buggering up when I try to use it. I get: Drupal\Component\Plugin\Exception\...
-2
votes
0answers
21 views

How can I create a report of reusable components in pattern lab? [closed]

I have been working on pattern lab with twig (Atomic Design Methodology) since last year. I have created many atoms, molecules and organisms and reused them within molecules and organisms. Now I want ...
0
votes
1answer
31 views

Unknown drupal_view() function although Twig Tweak is installed

Acquia BLT won't let me commit some Twig. > tests:twig:lint:all Validating twig syntax for all custom modules and themes... Iterating over fileset files.twig... ERROR in ~/repos/agency/client-...
0
votes
0answers
46 views

How do I add CSS classes to an image field?

My goal: I'm learning drupal. I'm creating bootstrap carousel myself. Without any plugins or themes. I use default classy theme. So far what I have done. Administration -> Configuration -> ...
0
votes
1answer
17 views

Using Less in Barrio Subtheme

I am attempting to use Less in my Barrio sub theme on my Drupal 8 instance, but am running into some issues with it actually loading onto my page. Right now, I have three less files: variables.less ...
0
votes
0answers
13 views

When is [“und”] necessary in pre process hooks?

I've noticed in preprocess hooks that sometimes a field's value is found at - for example: $vars['field_caption'][0]['value'] and sometimes it's at $vars['field_caption']['und'][0]['value'] Which ...
-2
votes
2answers
33 views

How to load my module's css file after my theme's css file?

In my theme, I have css files loaded through mytheme.libraries.yml and mytheme.info.yml file. In my module I have added a css file like this function mymodule_page_attachments(array &$attachments)...
0
votes
0answers
33 views

Adding classes and aria labels to menu through template file to add accessibility, Drupal 7

How can I add classes and aria labels to main menu in template file Drupal 7 to enable accessibility in main menu dropdown. "ul" and "li" tags already have styling I need to add &...
0
votes
1answer
50 views

How to get pathInfo in twig? [duplicate]

I want get the pathInof in my template twig : How i can reach pathInfo please in my template ?
0
votes
1answer
18 views

Properly override template_preprocess_book_navigation function in Drupal 8 Book module

I'm trying to find what is the proper way to override the template_preprocess_book_navigation function from the Drupal 8's core Book module. I want to add only two lines (bolded), but don't know how ...
-4
votes
2answers
79 views

How can I style the Gutenberg module editor? [closed]

I'm trying to modify the CSS in the Gutenberg module to change the editor layout. Gutenberg uses SASS files to generate the CSS. I tried editing the CSS files directly, which I recognize I shouldn't ...
-3
votes
0answers
31 views

Print views block in the custom block/ node/ panels (with php filter input) in the Drupal core 8.9.2

In drupal 7, I can print any views's block in node template or custom block (with Text format : php code) by using below code: <?php print views_embed_view('view_name', $display_id = 'block_name'); ...
0
votes
1answer
24 views

Twig Template print field - if not node number

I can print an image field in my node template like this: {{ content.field_big_image }} But can I say "print this field but not if the node number is node/45" ?
0
votes
0answers
34 views

Drupal 8 custom theme, twig and template

I want to display all authenticaed users in a custom template with a custom twig file. All works fine, except that the twig file is not recognized or loaded. My module name is "ThemeLoader" ...
-3
votes
0answers
22 views

CSS issue with module Entity Print

I install and activate entity print on my Drupal 8 website. I create a theme entity-print--node--produit.html.twig in my subtheme/template/node. {% set node = content[0].0["#node"] %} &...
0
votes
1answer
29 views

How can I split the body field to insert content between the first and the second paragraph?

I have a node which shows content from the body field. I want to add a another paragraph or a block between between the first and the second paragraph, after the first </p> and before the second ...
-1
votes
0answers
9 views

Remote Video file URL in Twig template

I am trying to access a remote video from the Media file in Drupal 8.9. field_home_difference_videos if the field that has the remote video and I know the file has been successfully uploaded to Media....
-1
votes
1answer
66 views

Form in custom module using Controller: The HTML tag form isn't present in Twig

I'm trying to render limited user edit form on custom page using Drupal Controller. In the routing.yml I defined _controller, I do not want to use _form. I want to display on the form e.g. only ...
-2
votes
1answer
50 views

how to apply a css code for a specific screen size

i am new in Drupal , in my case i have added a css code to implement it for just a specific width but in return i see it displayed for all screen size not the small or medium size it appears in all ...
0
votes
0answers
10 views

Missing Some Block Fields Layout Builder

I'm working with layout_builder and page_manager together and I'm having some issues. I want to add an existing node to my right sidebar, but I don't see the option anywhere where I can do that. In D7,...
-1
votes
1answer
40 views

Why does the login form become unusable after I removed all content from input.html.twig? [closed]

Actually I am stuck in a big problem . i am using input.html.twig file and i remove all the content from that and then when i see my default registration form and user login form which is prebuild in ...
0
votes
0answers
14 views

Adding full HTML field to Superfish/navigation

I'm looking to add a simple tag to a few letters in the navigation menu. It's super important that the person I'm working with has italics surrounding a few letters every time a certain work is ...
1
vote
1answer
15 views

Display summary of paragraph text field in twig [duplicate]

I have a paragraph type called News. In this paragraph type I have a text field (field_news_intro ) with a summary. How do I display the summary in a twig template? content.field_news_intro.summary ...
0
votes
0answers
11 views

Get upload date of a file

On my Drupal project, for a local cycling club, on the pages that show the different routes we'll be doing there is a link to a gpx file that contains the route details. Since routes change often ...
0
votes
0answers
17 views

background image with fallback

I am trying to add header images to my pages. I am currently getting the image in the form of a background using file_url(node.field_custom_image.entity.field_media_image.entity.fileuri) the problem ...
0
votes
0answers
35 views

Add class to button with specific class

I'm trying to add the class 'on-load-click' to any btn with the class 'webform-submit' <div class="form-actions"><button class="webform-submit button-primary btn btn-primary ...
0
votes
1answer
35 views

Block plugin's render array values ending up in $variables['content'] instead of $variables

I've got a bizarre issue where my the render array from my block plugin's build() method doesn't seem to be properly interpreted by the template. I've got the following setup. function my_module_theme(...
0
votes
1answer
25 views

Is it possible to call response()->setStatusCode() within hook_theme_suggestions_page_alter?

We set up a custom error page theme by creating a block with the error text and then used the following code within a hook_theme_suggestions_page_alter implementation to determine when to override the ...
0
votes
2answers
70 views

How to remove stylesheets only for anonymous users?

I am trying to remove all unnecessary/unused stylesheets for anonymous visitors to get better performance and a clean <head> section. This works fine by listing them inside mytheme.info.yml: ...
0
votes
0answers
19 views

How to add wrapper to article teaser content

I need to add a wrapper around the title, body, id, and created fields of the teaser below but am not familiar with how to implement this in a twig template. I need to have the image in a seperate ...
0
votes
0answers
29 views

How to use parent paragraph or field name in template_preprocess_file_link function?

We created custom theme suggestion for fields links using this code function THEME_theme_suggestions_file_link_alter(array &$suggestions, array $variables) { $route = \Drupal::request()->...
0
votes
0answers
12 views

getting custom field values

I set up a content type of example with custom fields. How can I get the field values to show in my twig template? I have tried {{ content.field_formattext‎ }} and that doesn't display anything.
0
votes
0answers
10 views

How do I add a class on a “checkboxes” element's option?

I have an exposed field with a "checkboxes" field, that I need to theme by adding (and removing) Drupal's default classes. I found close to nothing about how to do that, excepted this answer....
-2
votes
1answer
55 views

Show node summary (teaser) as tooltip/ Alt/ Title text on hover over nodes titles on front page with Views

I have a custom front page view showing nodes titles only without teasers. I want to have the teaser of each node show when hovering over any title. Something like: <a href="{{ url }}" ...
0
votes
1answer
31 views

How can I check in Twig if an advanced theme setting option is unchecked?

I've a list of advanced theme option(checkbox) to not display, such as search bar. I did many research about custom advanced theme setting, but all the samples are {% if remove_searchbar %}{% endif %}....
0
votes
0answers
21 views

Is there a way to pass custom data to a form template?

I have been tasked to customize a view, and I have been struggling with its exposed form, because I need to display some informations. Here is how it should look: These elements act as a checkbox, ...
1
vote
1answer
27 views

How can I show a date in Urdu?

I am working on printing dates in more than a language. With Drupal 7, I used the following code. <span class="arabic-date"> <?php $arrayurdudays = array('', '', '', '', '', '', ...
0
votes
0answers
16 views

Optimized images in custom theme

All of the image optimization modules are for images you upload through the admin portal as an Image content-type, but how would one optimize images that are in your images folder in your custom theme?...

1
2 3 4 5
208