People who code: we want your input. Take the Survey

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

how to set complete site background to a color or image? [closed]

I used this: wrapper { background-color:yellow; } but I want really everything in the background to get colored. how to? Code above just makes the wrapper background change.
0
votes
1answer
712 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
1answer
275 views

add js by #attached - hook_page_alter in theme's template.php [duplicate]

I am trying to add js by #attached, as I understand it's better from a caching perspective then drupal_add_js(). I try to use hook_page_alter() in template.php. I have the following code: ...
0
votes
1answer
28 views

The 'drupal' way to implement delete button UI

I think I'm missing something fundamental here. What's the 'right' way to implement a delete button on the UI-end? My app has a classic list-type data model: User has wishlist(s) -> wishlist has ...
0
votes
1answer
2k views

Iterate through user custom fields in twig

I'm trying to iterate through a user reference field using twig. I'm able to get the username, but not any of the custom fields that I made for users such as "First Name" and "Last Name". {% for item ...
0
votes
2answers
4k views

How to get node url from Entity Reference field?

We have an ECK Bundle that has an Entity Reference to Article and Basic Page content type. In the twig template we are using the following line below to get the node's nid value and then using that in ...
0
votes
3answers
3k views

Programmatically loading Custom block in page/node preprocessor

I've followed some previous solutions on DA to programmatically load a Custom block in my page preprocessor hook but nothing I try seems to be working. Currently, my custom block is within Structure >...
0
votes
1answer
570 views

Changing user picture HTML output on user profile

How do I customise the HTML output for the user picture on a user profile? I can output it in user-profile.tpl.php with <?php print $user_profile['user_picture']['#markup'];?>. However this ...
0
votes
1answer
1k views

How do I add attributes to CSS in theme.info?

I'm try to add a stylesheet switcher. This requires the following CSS files to be included on the site. <link rel="stylesheet" type="text/css" href="styles1.css" ...
0
votes
1answer
4k views

Preprocess taxonomy for a custom template file

In Drupal 6, I am customizing a view where I am trying to make the taxonomy terms work in all the page template files. This is the code in the template.php file. function getTermsName($taxonomy_id) {...
0
votes
1answer
1k views

How do I integrate the Color module in my theme?

I have installed drupal 8.4.2 and created a subtheme with base theme bootstrap. I want to customize settings adding the color module, but really I do not know what steps I am missing. I have ...
0
votes
1answer
4k views

How to pass a custom Form to a Twig template

my problem is that my drupal 8 form is not getting rendered in twig template. I created a form with build form method in drupal 8 when i tried it to pass in twig template it is not getting passed.for ...
0
votes
0answers
297 views

How can I combine the output of two separate fields in template.php?

I have two fields displaying multiple values from select lists. The first field's a term reference field, the second's a text list. So, print render($content['field_term_list']) produces Term1 Term2 ...
0
votes
1answer
57 views

In a view how to replace the date of creation of the comment by the date of the flag?

I created a "like" flag on the nodes. I created a view that displays the comments. I want my view to show only comments posted since the flag date. The solution will be to create a filter criteria ...
0
votes
1answer
987 views

Dynamic Views Pages - How to add in meta tags to these generated pages?

I have 1000s of dynamically generated views pages using contentual filters. I want to be able to take certain keywords from these generated pages and add them to the on page meta tags. Currently I do ...
0
votes
0answers
233 views

Expand menu links down in a tree

I'm using Nice menus, but it expands children sub menus to right only. I want it so that when you hove on main parent link, it drop-downs a sub-menu with all its children submenus expanded down in a ...
0
votes
1answer
2k views

How to get path of image from file id

I have this output from my twig template dump: /var/www/html/vendor/twig/twig/lib/Twig/Extension/Debug.php:56: array (size=7) 'id' => string 'views_block:about-block_1' (length=25) 'label' =&...
0
votes
1answer
1k views

How can I override template_preprocess_file_link function?

I want to print file size near file link in file-link.html.twig template. To do so I need something like {{ filesize }} variable avaiable in template. I tried to override ...
0
votes
1answer
1k views

Is there a way to get (and use) an environment variable in a template file?

I would like to add a JavaScript call to my html.html.twig file, but there are two separate .js sources depending on which environment I'm on (production, and non-production). I believe Acquia Cloud (...
0
votes
2answers
3k views

Add Unique ID to Menu Item

Is it possible to add a unique id or class to each li element in a menu, perhaps using a preprocess function? I want to be able to target each menu item individually with CSS. I could probably use ...
0
votes
1answer
103 views

Custom view mode issues

My goal is to switch between different view modes based on the node path (pattern). In my case, the patterns would be: dossier/node-alias => default template dossier/node-alias/cover => cover ...
0
votes
1answer
308 views

How to view the user's status? [duplicate]

I copied the twig file from the user view in my theme. I want to display: "Online" if the user is logged in. "Absent" if the user has not had any activity for more than 15 minutes. "Offline" if the ...
0
votes
1answer
521 views

Views - Custom Field Layout?

I'm looking for direction on how to format the field layout of a view. Here's the layout I'm looking for: -------------------------------------------------- | Field1 | Field2 | Field3 ...
0
votes
1answer
145 views

Image getting delete away by the cronjob later in drupal 7 using theme settings

i`m using system theme settings alter to add 4 images for theme, images are getting deleted /swept away by the cronjob later .trying using FILE_STATUS_PERMANENT images are not getting set as ...
0
votes
4answers
838 views

Add unique class to each link outputted by views

I'm using views to output a list of links (fields). I can type in an url and a text and the text becomes the link text that goes to the url. Now I want to be able to add a unique class to the link ...
0
votes
1answer
635 views

How can I display author name, picture and signature when viewing a full node in D6?

I'd like to display the name, picture and signature of a node's author at the bottom of each node. The node.tpl.php file that I'm using (supplied by the zen theme) includes variables for the author's ...
0
votes
1answer
3k views

Warning: Cannot use a scalar value as an array

function theme_test($form) { $output = ''; foreach($form['field'] as $key => $val){ $output .= '<div class="test">'; $output .= drupal_render($val['uid'. $key]); $output .= ...
0
votes
1answer
2k views

Theming User Profile Edit Form not Rendering results… Help?

I am not rendering any results. This is my template.php: function fueldeluxe_theme($existing, $type, $theme, $path) { /** * Account edit Forms */ $items = array(); $items['...
0
votes
1answer
157 views

Need help defining IE specific stylesheet with Zen Starter-kit and Conditional Stylesheet Module

I need help defining a conditional IE stylesheet in my .info file. I am using the Zen starterkit as my base theme, and I have the conditional stylesheet module installed and enabled. I have added an ...
0
votes
1answer
535 views

Is it possible to render a twig template for “later use”?

I have been asked to create a custom module that outputs a node's content in a way that it will be easy to print or export to pdf. I came accross this question and this is litteraly what I'd like to ...
0
votes
1answer
95 views

Forced rendered node view results in empty node links

In order to send html email using drupal/swiftmailer I load and view a node. Then I pass it to the rendere. In the email sent, generated node__links are empty. As node_links uses #LazyBuilder, Im ...
0
votes
2answers
2k views

Remove all js from template

I'm trying to remove all javascript for anonymous users but I've hit a roadblock. This is the php I'm using in template.php (phptemplate_preprocess_page function): $js = drupal_add_js(); unset($js['...
0
votes
2answers
255 views

Route that renders a node has title of route rather than node title

I have a route that takes a wildcard $product and then loads a default node that is stored in config. This is working (i.e. the node is rendered on that path) but instead of the node title it is ...
0
votes
1answer
435 views

How to add a custom variable that can be accessed on bootstrap's menu--account.html.twig?

I have a custom theme (subtheme of drupal bootstrap theme). We are overriding menu--account.html.twig. So I copied menu--account.html.twig from the bootstrap theme template folder into my theme's ...
0
votes
1answer
844 views

Change the way “add content” and “node's” are displayed

I was wondering how one would go about changing the layout of the nodes when you are adding content, as well as when you view the full story. I want certain text to be bigger, some fields to be ...
0
votes
1answer
45 views

How is a field's key (rather than value) obtained?

In Drupal 7, I have a page content type that has a field called group (so the machine name is field_group). The field is a List (integer) field type. This field might have allowed values as follows: ...
0
votes
2answers
1k views

Add class to Bootstrap login form button

I want to add a class to a button in my login form. I have searched through all the template files and I cannot find where to do this. I found the following code that best matches the form in modules/...
0
votes
2answers
112 views

Add class to new posts with Views

I have a view (using Views module), which displays a list of all Titles of a custom content type. What I want to do is add a CSS class to the posts that are new (posted within 24 hours for example). I ...
0
votes
0answers
60 views

Change image styles based on selected theme

I have multiple themes under one installation and using SwitchTheme http://drupal.org/project/Switchtheme to switch between themes as selected by the user. My problem is I have a view displaying ...
-1
votes
2answers
9k views

How to calculate a date difference in twig?

I am using date range field in views and would like to display dates in the format 5-May +3 days using twig. Te values that can be used as per drupal are: {{ field_mycontent_dates__value }} == Raw ...
-1
votes
2answers
87 views

Naming a template file

D7, bartik. A comment form is created by an .inc file (modulename.page.inc). This comment form is to comment on existing comments. To create the comment form, the inc page says: function ...
-1
votes
1answer
1k views

How to get views header and footer in view block template

I have created view as block and in block twig template i can print view fields as content['#view'].field['field_machine_name'].value(row) HOw can i print text in textarea that i set as header and ...
-1
votes
3answers
686 views

How to replace drupal-render-placeholder manually?

I've got the element with following plain string (result of some kind of side effect): <drupal-render-placeholder callback="Drupal\block\BlockViewBuilder::lazyBuilder" arguments="0=myform&...
-1
votes
1answer
50 views

How to update the TWIG flag conditions?

I have this code in my sub theme : bootstrap_subtheme_front_office_old.theme <?php /** * Implements hook_preprocess_HOOK() for user.html.twig. */ function ...
-1
votes
1answer
170 views

How do I print the local task bar in different places depending on the base route?

I want to print the local task bar used when users register/login/reset password at another part of the page, than the other local task bars. The base route for these menu links is user.page. https:/...
-1
votes
4answers
474 views

Use module to change custom type theme

I have built a module that adds a new custom type. I want to control the theme of that node type, and use a custom theme page for that node type. I can't find any documentation about this. How can ...
-2
votes
1answer
55 views

How to enable template while creating node

I want to enable different template for different node while creating node. for eg: I am creating blog1 node, then while creating blog1 node I should be able to choose template in drupal 7. Please ...
-2
votes
2answers
607 views

Why is HTML rendering as Plain Text in a simple 'title' alteration?

I have been able to change each node's Comment Link 'title' text (that on default renders 'Add new comment') with the below code, but if I add HTML, it renders as plain text. I'm trying to add a ...
-2
votes
1answer
709 views

How to enable or disable the “Add to Cart” button for products based on the role of the store owner?

I have Drupal 8 and Commerce 2. I created a "Merchant" and "Premium Merchant" role. By default, users who create a store have the "Merchant" role. What I am trying to do is the following. If the ...

1
16 17 18 19
20