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
votes
0answers
18 views

How do I change the Font for a “Title Field Label” [closed]

I have very little experience with coding but am a fast learner and need to make a change to my page regarding the title field label fonts. They are too small and needs to be bold face. Can some one ...
1
vote
2answers
46 views

How can I override the markup of a view I printed in a template file?

I installed the Twig Tweak module on my site to render Views on the home page. I want to make the display mode frontpage_tasks for the current user, his account, his stores and his groups. {{ ...
-1
votes
0answers
14 views

Show result of current selected value in drupal 8 better expose filter used multiple filter

I want to pass only the current selected value/ want result of current selected value even if there previous selected value in Better expose filter. I have taxonomy term with multiple term that I ...
0
votes
2answers
26 views

Theme suggestion template is not being picked up

I add template suggestion in my discount module: function discount_theme_suggestions_field_multiple_value_form_alter(array &$suggestions, array $variables) { if ($variables['element']['#...
0
votes
0answers
11 views

How can I render single Simplenews fields in Twig?

I had a Drupal 7 site and I have build my newsletter with print render. Example: print render($build['field_title']); print render($build['field_image']); print render($build['field_description]);...
0
votes
0answers
21 views

full-width hero image [closed]

I am trying to implement a simple hero image feature for a site I am creating (using Drupal 9). It seems that there are may ways to go about this, and I hope someone might be able to guide me to a ...
1
vote
1answer
22 views

What should be used instead of raw filter?

Drupal 9 theming documentation indicates that the Twig raw filter is deprecated in favor of verbatim. The ds-field-expert.html.twig template uses raw to render the input in the prefix and suffix field,...
-2
votes
1answer
30 views

How to override body field value in preprocess method?

I would like to override the body value filled by a user in a preprocess method in my_module.module (D8) Body value is well replaced in the preprocess method, but not in node.html.twig How to do this? ...
0
votes
1answer
48 views

Can I make and process a form fully from the template layer? Without using modules

I am working in a project which by policy of the business does not allow me to use ANY modules other than core. I cannot add custom nor contrib modules. This is not something that can be changed at ...
1
vote
1answer
10 views

How do I implement bootstrap's panel component for a specific block / block region in my bootstrap (sub) theme?

I have a bootstrap sub-theme, and would like to render some of my blocks using Bootstrap's Panels components, so that the block would need to be wrapped something like this: <div class="panel ...
0
votes
1answer
13 views

Can I add pagination to individual blog posts in my twig file?

I have a views page which has all the blog articles, and you can click on a link to bring you to a single blog page. On that single blog page I want to be able to add buttons for Previous and Next ...
-1
votes
0answers
34 views

How to show managed_file field with Twig?

I add field with managed_file field type like this: $form['picture'] = array( '#title' => t('Upload file :'), '#type' => 'managed_file', ); I return the form in template twig ...
1
vote
1answer
40 views

How to display a custom block in a view twig file?

I added a custom block in the header of a view, and I am trying to get it to display. The block contains social media icons and links. If I want to add a custom text area, I can use this code - {{ ...
1
vote
2answers
48 views

table styles not applied by bootstrap sub-theme

I'm writing a custom sub-theme of bootstrap with Drupal 9, and have noticed that table elements in my forums do not render properly: This is despite me selecting "Bordered Table" in the ...
2
votes
2answers
49 views

How can I target the first item in a view?

I have a views page that shows all the latest articles that were posted. I want to show case the latest article in a different div on it's own, and then have my loop with all the other articles. This ...
1
vote
1answer
57 views

Entity Print PDF Layout for Views page

My requirement is to convert a views page into a PDF. I have created the views page with table formatting and a PDF plugin attached to the header that allows one to download the views page as PDF. I ...
2
votes
1answer
47 views

How to force rendering by the site theme instead of the admin theme?

When rendering HTML in hook_node_presave(), everything works as expected when I save the node manually. However, when I use the "Save content" action on the content admin view (at /admin/...
1
vote
1answer
61 views

How to programmatically replace a field label and content before rendering?

I expected to be able to do it with THEME_preprocess_field, but the data at that point seems to have only the content's markup and not the label. I would need an instance where I can change both, ...
0
votes
2answers
49 views

Adding to {{ html_attributes }} when a Twig Template is Used

I have a Paragraph Twig template that outputs FAQs in HTML format and also includes the Google FAQ data structure in the markup. What I need to do next is include itemscope itemtype="https://...
1
vote
0answers
30 views

Can't add custom CSS file to specific admin pages

So I want to add a CSS file to the node create/edit forms. My code is: function general_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if (in_array($form_id, ['...
2
votes
1answer
34 views

Twig attribues.addclass nesting issue

Apologies if this has been asked before, but I'm on my first week working with drupal and twig. I have the following code: {% set container_classes = [ 'paragraph', 'paragraph--type--' ~ ...
0
votes
1answer
52 views

Adding a variable to a menu twig template

Im trying to use bootstrap for an accordion menu. My issue is that I need unique ID's for each accordion item. I found some similar topics here: Add Unique ID to Menu Item and here: How to add a ...
0
votes
0answers
30 views

How to disable form.js for the add comment form?

I have a node content type with comments enabled, and the "Add comment" form is configured to be displayed on each node page. Embedding the add comment form causes JQuery and all its ...
4
votes
2answers
67 views

Use custom content entity theme suggestions in own module?

I have a custom content entity called 'offer'. I've added template_preprocess_offer() and offer_theme() to the offer.module file. function offer_theme($existing, $type, $theme, $path) { return [ ...
0
votes
1answer
30 views

Custom Theme Repository update

I have a custom theme that I use in several websites. My theme is on gitlab. I can download my theme by composer in different websites. My problem is when I update repository theme with a fix or new ...
0
votes
1answer
57 views

Check if empty region failed

I try to check if my sidebar second if empty. If it is not empty, I add a class col-md-8 on my section-main. To check if the sidebar is empty I use this code in the page.html.twig template of my ...
0
votes
0answers
35 views

Two pagers, but the second one doesn't show

I have a page where 2 pagers are in use but the second does not show. The view in question has 1 block and 1 page. Both have pagers setup in views 3 and the pager id for block has been set to 1 and ...
0
votes
1answer
38 views

Referencing CSS file from theme library inside Embedded Widget Paragraph type

I have an article page in Drupal 8 that contains a chart (inserted into the page using Text paragraph). The chart uses CSS classes that I have created inside the global stylesheet. It works, but I don'...
0
votes
1answer
35 views

How do I display a Media entity reference field in a nested paragraph on a template?

I have been working on this for 2 days and I can't figure it out. I hope someone can help me. I have a paragraph (dinamic_columns_grid) that has an entity reference field to another paragraph (...
0
votes
1answer
32 views

How do I check the image's view mode in the image.html.twig template?

I'd like to detect the custom view mode (Structure > Display Modes) selected for an media entity (image) and then be able to have html output based on the view mode. Specifically I have a custom ...
0
votes
1answer
16 views

Meta title doesn't show page title in panelizer

When I use Panelizer for one of my content types. My meta title tag doesn't include any of the node's page title. It's only displaying my Site name. So when I look at the tabs it just has my site name ...
0
votes
1answer
28 views

Hide region and make second and third region bigger

I created a custom layout for layout_builder that uses 3 regions/columns. IF my FIRST region has no content I want to make second and third regions width bigger. I tried to use an {% else %} statement ...
1
vote
2answers
15 views

How do I get node revisions to use my custom template?

I have a custom node template for my content type of Listing, node--listing.html.twig. It is quite heavily customised for the client. However when we go to view a revision (e.g. /node/144/revisions/...
0
votes
0answers
26 views

Is there a way to override a static twig template?

So I have 2 themes. The main custom theme we are using and bootstrap as a secondary theme that supports it. However, there are some things that appear on the page that are only there because of ...
0
votes
0answers
21 views

blocked due to MIME type (“application/octet-stream”) mismatch

I've been troubleshooting a memcache issue on our Drupal 7 site and in the process the front end CSS broke, meaning all content was unstyled. The Chrome console has a message: The resource from “/...
0
votes
1answer
23 views

Pre process a template that uses layout display

I want to preprocess a user account display. I want to manipulate a field value at display time. for example, i want to change: field_prefered_color: redto : field_prefered_color: red - Cool, that is ...
3
votes
1answer
43 views

Change the theme used for the user reset password page

Drupal 8 - I have the following issue: Administrator user creates an account for a user User gets a welcome email with password reset link Upon browsing the link and passing through the hint page, ...
0
votes
1answer
52 views

The website encountered an unexpected error. Please try again later( Olivero subtheme)

Tried to make an Olivero subtheme. Followed drupal tutorials and after several unsuccessfull attempts ended in error "The website encountered an unexpected error. Please try again later" on ...
0
votes
1answer
37 views

Changing the layout of a Taxonomy Term Page

By default my taxonomy term page lists all articles using this term in 2-columns. I would like to change it to a 1-column layout. (1) I have created a custom display layout for the taxonomy group: (2)...
0
votes
2answers
37 views

Display level-3 submenu on twig

I'm creating a node--page.html.twig and I'm using twig_tweak to help render a block for my sidebar to display Level-3 links on my menu. Currently, most of my pages are displaying correctly because ...
-1
votes
1answer
35 views

How do you add a class on webform submission in the modal?

I am using webform in a modal. now I want to add a class in the confirmation pop up of the webform. How I add class in submission form in twig. I am using html.html.twig of my theme to show webform in ...
0
votes
1answer
24 views

Additional attribute for menu link

How I can add itemprop="url" for each link (<a>) in main menu? So, I need to get from <a href="/node/114" data-drupal-link-system-path="node/114">Test</a&...
0
votes
1answer
33 views

Cannot get the sub-theme retrieve the CSS files from libraries

I have localized Bulma theme following the instructions which were as simple as creating a new directory called 'libraries' under main directory (httpdocs) and putting the sources files in it. No ...
0
votes
1answer
45 views

I can't override the node template

I have installed Barrio Bootstrap (8.x-4.33) and it worked so far. But I can't override a template for a specific node type. I copied the original template into my subtheme/template folder and named ...
0
votes
1answer
34 views

How to use hook_field_preprocess to add a prefix/suffix to an entity reference field for different view modes?

I'm trying to move some markup from twig templates to hook_preprocess_field(). I have an entity reference field (media image) that I want to add a prefix and suffix to. I added a prefix and suffix ...
-1
votes
1answer
26 views

How do I get the taxonomy term name?

I added a taxonomy field inside a view. I need to show the term name on the page in a grouped way, like this. taxonomy term1 name title1 content1 title2 content2 taxonomy term2 name title1 ...
0
votes
1answer
54 views

How do I get product variations in a preprocess function?

I'm trying to do something like this. function clientname_preprocess_commerce_product(&$variables) { $product = $variables['elements']['#commerce_product']; // Get the product variations and ...
0
votes
2answers
42 views

HTML is being printed in the output

The output from the below code is printing HTML. How can I make the "p" tags disappear? <p>answer 1</p> {% block paragraph %} <div {{ attributes.addClass(classes) }}> ...
0
votes
1answer
26 views

How can I write an if else statement in Twig based on commerce stock quantity?

Building a D8 Commerce site and trying to hide the price if the product is out of stock. I can access the stock value with this: {{ product.variation_field_stock_level.0 }} I've tried this: {% if ...
0
votes
0answers
23 views

Fatal error: “isEven” is an invalid render array key /web/core/lib/Drupal/Core/Render/Element.php

we have this code in template.theme but when we go to view the web, the page show a error as this: "isEven" is an invalid render array key /web/core/lib/Drupal/Core/Render/Element.php . I ...

1
2 3 4 5
209