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

how to display dynamic field values to template?

I am making a module, each time user make content type and add fields to it, all its field values get rendered into static template dynamically. For This i am using noad_load_multiple() to get all ...
0
votes
1answer
565 views

HTML output of whole page

I am trying to generate html output of whole page and then pass it to response array.I am doing something like this: $page = array( '#theme' => 'html', '#page_object' => new HtmlPage(...
0
votes
3answers
1k views

CSS changes not taking effect in customized styles folder

I am trying to size the banner in a Jackson theme on my site to fit to the 960px wrapper size have in customized folder in sites/all/themes/mytheme/styles/mytheme.css but no matter what I do the ...
1
vote
1answer
108 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 ...
0
votes
2answers
1k views

How to incorporate AMP in an existing theme?

Is there a way to incorporate AMP into my Porto Theme?
8
votes
7answers
9k views

How to add a CSS class to an render array?

In a template file, before print render($content['field_image']); I would like to add a CSS class to the image in the $content['field_image'] render array. How can I do this? Here is the render array: ...
3
votes
2answers
10k views

Add attributes to the render array

I am trying to add some attributes to a render array. In Drupal 7, we can do this by adding a property in an array like the following. $items[] = array('data' => $item_data, 'id' => 'someId'); //...
0
votes
1answer
1k views

Preprocess Node function not being called

I'm attempting to perform an action in a preprocess node hook inside my .theme file, but I can't seem to get it to fire. Here's the content of my customtheme.theme file <?php function ...
1
vote
2answers
653 views

theme contact form block

I am using contact_form_blocks-7.x-1.x-dev module. Using this module I have embedd contact us form in my website. For themeing I have created file named block--contact.tpl.php. Cleared cache, but it ...
2
votes
1answer
739 views

How do I separate the “Product” select list & “Add to cart” submit form in a node product display?

I have a node product display which references 2 different products. When I use the code below, it prints out both the "product select" form + the "add to cart" submit form. How do I print them out ...
3
votes
1answer
454 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 ...
1
vote
3answers
2k views

Views to use relative paths for image fields

How can we tell views to use relative paths for dispalying images using image fields. I have created a views slideshow which is displaying images using absolute url which is causing the images to ...
4
votes
1answer
1k 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 ...
1
vote
2answers
2k views

Add CSS class to <form> element using webform and template file

I have an existing webform in Drupal 7 which I am trying to theme. So far I managed to add CSS classes, placeholders, prefix, suffix,.. to form elements (fields) but not to the actual <form>-tag?...
0
votes
1answer
744 views

How to modify the commerce price formatter label to match shipping service?

Please see attachment. Using Commerce Kickstart 2. I have a working solution, but I am hoping someone can tell me how to improve it, as it 'feels' poor. The footer for the default shopping cart view ...
1
vote
1answer
31 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,...
0
votes
1answer
405 views

Get the url for an images in a Field Collection for the Node Template

This is a bit messy so bear with me. I've built a node with a field collection 'field_meet_videos'. That field collection contains another field collection 'field_about_video'. The inner field ...
2
votes
1answer
897 views

Views PDF CSS file not being applied on generated PDF

I've created a pdf display with views_pdf module in views, and under the PDF SETTINGS i've included a CSS File (eg. sites/all/themes/custom/mytheme/css/mytheme.css). When viewing the page display of ...
0
votes
2answers
825 views

Issues with Zen subtheme

I am running a Zen subtheme for another drupal instance and it all worked fine. However, when I copied the folders across to my new Drupal instance, all I see is The name of the site and User menu :...
1
vote
2answers
2k views

print field in views row template

I try to make a custom view using templates. I need to print one certain field at the last row, after all other fields have been printed like so: --1st row field1 field2 --2nd row field1a field2a --...
1
vote
2answers
705 views

template_preprocess custom block type

I have a custom block type with two different fields. What I am trying to accomplish is, to hide the first field if the second is not empty. That seems like something that could be done in ...
0
votes
2answers
668 views

Trying to create a table with an uid field that auto-increments and is the primary key, but keep getting an error

I'm working on an .install file for my module in Drupal 7. I want to create two tables, one called tls_connect_floormap_images and one called tls_connect_floormap_coords. I'm not having any trouble ...
2
votes
2answers
223 views

How to alter file upload description text

I'm trying to customize text for a file upload widget in Drupal 8. Here is a screenshot of the widget: I just want to display the first 15 MB which I added as file field description text in the ...
0
votes
1answer
14 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
vote
1answer
13 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
1k views

Rewrite markup of a field in twig template

I want to calculate dynamical a value and give it back in the markup without saving the newValue. I try this with: {% set content.field_my_field[0]['#markup'] = newValue %} This doesn`t work! The "...
0
votes
1answer
555 views

Issues with the title for a custom entity

I have a custom content entity in which I have defined all the fields in the annotation (and it shouldn't need to be altered through the UI in any way that I can think of). In the annotation I have ...
-1
votes
3answers
3k views

how to add class to {% block content %} in twig

Here goes my drupal 8 code, so basically block.html.twig is extended to block--mytheme-sitebranding.html.twig. Now I want to add a class to this: {% block content %} {% if site_logo %} <a ...
0
votes
1answer
560 views

How can I use a Twig if statement in a View rewrite

How can I add a Views field rewrite using Twig that will display the moderation state only if the node is in draft state or review state? I tried the code below but it prints all of the moderation ...
0
votes
2answers
2k views

How do I integrate a custom header and footer?

I need to add a custom header to a theme that I am currently building. The only way I can seem to get the header and footer to show up on the page is to hard code it into the page.tpl.php file. I've ...
2
votes
2answers
9k views

Alter views fields using preprocess function before render?

How do I edit a views field using preprocess before it is rendered to the screen? Let's say the field originally outputs something like this: Note title now I want to change that adding the number ...
0
votes
1answer
849 views

How do I get a URL variable in a template?

I am trying to include a certain .html file if the URL has ?work=1. So far I have this, which I got from Check URL for string in a Twig file. {% if 'work' in url %} {{ include('work/index.html'...
3
votes
1answer
1k views

Is there a way to override paths defined in *.libraries.yml

Guess I found a bug here and already filed it: Created custom profile, added https://www.drupal.org/project/mmenu dependency (which then is placed under profiles/profile_name/modules/contrib/mmenu). ...
1
vote
1answer
807 views

how to display an image in theme using img tag?

I need to display an image in the page footer using <img> tag. In my page.tpl.php I have following block: <div id="copyright"> <img src="../images/logo.png"> <p class="...
0
votes
1answer
509 views

How do I check radio buttons in Twig template?

In a form, I have this field: $form['payment'] = [ '#type' => 'radios', '#title' => $this->t('Payment Mode'), '#options' => [ 'chk' => $this->t('by check'), 'tfr' =&...
1
vote
2answers
3k views

Display both sort icons on sortable table columns

I'm using Drupal's theme table function to build a custom table. All of the columns on my table are sortable. I would like to visually indicate that they are sortable by putting both an ascending and ...
0
votes
1answer
514 views

Pass multiple sets of variables to theme function

If I want to loop through multiple sets of theme variables in my custom theme template, how do I define them in my theme function and pass them to hook_theme? For instance, in my case, I'm generating ...
1
vote
1answer
396 views

Is the homepage considered in_active_trail?

I'm learning Drupal 8, so still very new to it. I'm working on customizing the main menu. I've been able to add Twitter Bootstrap to my custom theme. I've made a custom menu--main.html.twig file. I'...
4
votes
3answers
983 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 ...
17
votes
3answers
29k views

How can I render plain text as HTML in a template?

I've run into a wall trying to render a SVG image markup code into html from a plain text field. I'm looking to render the SVG code from a plain text field without overriding the plain text field ...
1
vote
1answer
387 views

Theming a Fieldable Panel Pane — should I define a View Mode?

I added a Link field to Panopoly's Image fieldable panel pane, but I need to theme it so the link is silently wrapped around the image rather than displayed textually underneath. It also needs to be ...
0
votes
1answer
363 views

Field collection item not visible to anonymous user

I have a field collection, 'related content', that displays inside the 'page' content type tpl. It is a 'field' in the page content type. It works perfectly fine while logged in as admin, but cannot ...
0
votes
3answers
571 views

Styling label of a select list

I want to style the label of my select list with bold font and give it some color. This is the code for rendering form which I am using in a hook_block_view $form['dropdown_first'] = array( '#...
1
vote
1answer
402 views

Override Ajax throbber icon styles

I've been digging around the CSS and JS files but I haven't quite found the exact thing that places the throbber.gif where it appears when clicking on 'previous' or 'next'. The styling is in system....
0
votes
2answers
754 views

Use of Twig template for webform email

I'm trying to help my father out by building a webform (D8 version) for the 4 theaters his Old Abbey Friends are putting up. I've made the webform, now i'm setting up an email handler so that ...
1
vote
1answer
486 views

Theme settings to include different PHP files into template

I'm trying to include a template section into another template under conditions based on the themes settings. page.tpl.php <header> <?php $theme_header_style = theme_get_setting('...
2
votes
1answer
851 views

Display field collection items by using twig

I'm using the field collection module in Drupal 8 to encapsulate event informations so I've got a field collection with six sub fields (place, starting time, etc.). In my twig template field--field-...
4
votes
2answers
1k 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 ...
1
vote
2answers
57 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 ...
0
votes
2answers
490 views

How to display the pager on top and bottom of a custom search results page?

I have used the core Search Page functionality in Drupal 8 to built a search engine on my site. The pager is displayed at the bottom by default. How can i display the pager on the top also? Note: I ...

1
3 4
5
6 7
210