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

Database connection issues with Drupal 8 and Acquia DevDesktop

New to Drupal 8 and tripped up on this one. It seems something wrong with database but if anyone has tips please let me know! Here is my code: and here is error: And my drupal site isn't working at ...
-1
votes
0answers
15 views

Adding custom image of search item

How we can pass the custom image on search page in d8. I have created custom_theme_preprocess_item_list__search_results function in .theme file but I am not getting node details here, I am getting ...
1
vote
1answer
18 views

Render media url in node--page.html.twig

I have an Entity reference field field_video. It's a core Media field with a Reference type of Remote video. Because I use this field_video in my Hero section I need some additional markup here. ...
3
votes
2answers
57 views

What is the correct way to update my cached block when a node of a given type is saved or updated?

I have a custom module with a block plugin: SliderBlock.php class SliderBlock extends BlockBase { public function build() { $build = []; $build['#theme'] = 'slider_block'; return $...
1
vote
1answer
27 views

How to create content type “News”

A site user needs to be able to add news to Drupal 8 site. Some news might be own contents and some news might be from external sources. If the site user is adding a news which is from an external ...
0
votes
0answers
22 views

Fix problem in off-canvas menu module for Barrio Sub-theme [duplicate]

I need help with changing a Barrio(v 8.x-4.22) sub-theme of Drupal 8 This is what I've done until now: I installed the Barrio sub-theme I installed the Responsive and off-canvas menu Drupal 8 ...
-1
votes
0answers
18 views

Customization of sub-theme with left hand-side menu [closed]

I need help with changing a Barrio(v 8.x-4.22) sub-theme of Drupal 8 This is what I've done until now: I installed the Barrio sub-theme I installed the Responsive and off-canvas menu Drupal 8 ...
-1
votes
0answers
17 views

getting error on setup drupal 8.1.1 [closed]

Notice: Trying to access array offset on value of type null in Drupal\Component\Annotation\Doctrine\DocParser->Identifier() (line 969 of core\lib\Drupal\Component\Annotation\Doctrine\DocParser.php)....
1
vote
1answer
34 views

Need to add a JS file into <head> using a custom module with custom twig template

I have created a custom module and created a config page which we need to input the url on that page. Created a twig template within my custom module: <script src={{ js_file_url }}>test</...
-1
votes
0answers
21 views

Form wrapper is missing when rendering indididual components on page--node--edit.html.twig template

Form wrapper is missing when rendering indididual components on page--node--edit.html.twig template Using hook_preprocess_page we are able to create variables for form like $variables['node_form']...
0
votes
1answer
58 views

Render paragraph reference field in page.html.twig

In page.html.twig I want to show a paragraph reference field which contains a left and right text_field. The name of the reference field in the node is: field_intro. That field is linked to a ...
0
votes
1answer
17 views

More options for page--node--edit.html.twig for content type

Using my Theme debug I'm getting the following themplate suggestions page--node--blogpost.html.twig page--node--edit.html.twig When I tried to use different template to edit a blogpost template ...
0
votes
1answer
19 views

Can we access paragraph field in views-view-unformatted.twig?

Is there a way to access the fields in paragraph in views-view-unformatted.twig. I want to perform checking on field of paragraph before print the row something like this {% for row in rows %} {% ...
0
votes
0answers
12 views

Theme suggestion for file link in on commerce product page

I'm listing some files for download on a commerce product page and I want to customize the output. I'm trying to get a theme suggestion for file-link.html.twig but I'm failing to get them to work. I'...
0
votes
1answer
17 views

Page Content Type: Displaying error in Preview mode

Whenever I am creating or editing my page Content Type and go into preview mode I see these errors: And here is the code for it: The dark theme does not show up in preview mode though. However, if I ...
0
votes
1answer
21 views

How to add class to field--item element generated by paragraphs

I have a paragraph type called "Grid Item". I've created a file called "paragraph--grid-item--default.html.twig" where I print all my required fields. It all works as expected, but I need to add ...
0
votes
1answer
23 views

More template suggestion for views exposed form

Using the debug function I have found only one template suggestion for view's exposed form: form--views-exposed-form.html.twig I need to make changes to particular view, but I dont have other ...
0
votes
0answers
24 views

Render a controller template from a custom module in a theme page

I have created a custom module whose routes are defined as follows. bigdeal_infos.infos_controller_infosScreen: path: '/bigdeal_infos/infos' defaults: _controller: '\Drupal\bigdeal_infos\...
1
vote
1answer
19 views

How to access link fields (url and text) value separately in views template?

My views block has a Link field named field_link, attached to a Content Type named products, and I'm trying access link field values(url and text) separately in views template views-view-unformatted....
0
votes
0answers
40 views

How to add external CSS/JS libraries via library API and including these libraries in a field widget? [closed]

I can't load a library either using:drupal_add_library('mymodule', 'mylibrary'); nor by attaching it to the render array using $element[#attached][library]='module/mylibrary . I checked the chrome ...
0
votes
0answers
13 views

How to trim a Full HTML format field value, which can be used inside hook_preprocess_views_view_field(&$vars)

I have created a Taxonomy View that has a Global : Custom Text field, using hook_preprocess_views_view_field I'm placing other field's values with some customized markup in that field. Now what I ...
-3
votes
0answers
17 views

Can i use view filter without using twig tweak module,i want to get refferenced field content

{% for entity in node.my_content_type_field %} {{ node.my_content_type_field[loop.index0].entity.my_paragraph_field.entity.my_reffernced_content_type_title_field|view }} {{ node....
0
votes
0answers
14 views

Translate text in twig theme file [duplicate]

I'm using Drupal 8.8.1 and enabled translation core modules and it works fine for the content added through admin panel. However, I need to change the text which hard coded in html.twig files in my ...
0
votes
0answers
31 views

How can I print just one field of a view in a block template?

I created a view block that is "more by this author" and was able to configure the view so that it pulls the author of the current node and shows more pieces of content by that author. Hurray! I ...
-2
votes
1answer
24 views

How to place multi view in one page?

I have two content types and I wanna place two content views in one page with different display modes. How to solve it?
-2
votes
0answers
20 views

Copy / clone a theme with database, keeps linked to original themes's css

I try to clone a theme (Bootstrap SASS subtheme to be specific) with all it's contents for a new site which will be pretty much like the old one. I specifically want to retain all the layouts, CSS etc....
0
votes
1answer
39 views

Get url of referenced entity in twig based on target_id

I have a content type with a field « referenced entity » called field_suggestion_articles. User can choose related content and a view displays this list of related content at the bottom of the ...
0
votes
1answer
14 views

How can we define twig template based on checkout flow in Commerce 2.x?

I am using Drupal Commerce 2.x. I try to build different twig templates based on the checkout flow. So, I use hook_theme_suggestions_HOOK_alter to register other theme suggestions. However, I can't ...
0
votes
1answer
27 views

Create a button with an icon in render array, that can be themed by arbitrary contributed themes

Drupal 8 does not use HTML button tag for creating buttons, it instead uses the input tag to create buttons. This works fine for most part, except for buttons which include an icon gets messed up by ...
0
votes
1answer
31 views

Modifying twig file to show elements side-by-side

I am working on views with embedded filters and my resultant view fields have the below twig setup: {% set index = 0 %} <div class='row'> <div class="panel panel-default"> <...
-1
votes
0answers
23 views

drupal 8 portal website, gives error “The website encountered an unexpected error. Please try again later.” [duplicate]

Initially, website was crashed due to indentation issue in theme yml file. After fixing the indentation, the portal site was up for 5-10 min, and again crashed after setting bartik as default site and ...
0
votes
2answers
63 views

How can you automatically add CSS classes to <p> tags in the post body?

I'm trying to build a new Drupal site using the Tailwind CSS framework, which relies on inlining CSS classes onto HTML tags. This is fine in Twig template files where I have direct control of the ...
-1
votes
0answers
20 views

How can create a twig template for input type number field [duplicate]

I have created my template for input type number in a form but it is not working. Please help me to find the solution. input--form-control--number.html.twig {% extends "input.html.twig" %} {# /** * ...
0
votes
2answers
50 views

How to set multiple arguments for views contextual filters from twig

Am using twig tweak module to render views from Twig file. I have pass multiple values for the country contextual filter in the view. I was able to pass single parameter like: {{ drupal_view('...
0
votes
1answer
20 views

Print module theming address for user page

I am using the print module to have print-friendly pages. I followed theme suggestions, I could not make the theming work for user pages. So far, I tried the following I would like to theme user pages ...
0
votes
1answer
47 views

Twig template for custom entity not working

I created a custom entity called 'Representative' using the drupal console 'generate:entity:content' command. The entity works correctly I added a bundle of fields to it, added some content, and can ...
-1
votes
1answer
49 views

How to display the store url in a TWIG Message?

I have a Drupal 8 site with the Commerce and Message modules. In my TWIG Message I can display the title of the parent store of the product, but I cannot display the url of the parent store. How to ...
0
votes
0answers
11 views

Adding CSS in both custom theme and admin theme

How to modify some css to a tapir_table display being used in both places: in my custom theme and administration theme Specifically, i would like to make the qty and sku columns displayed on both ...
0
votes
1answer
38 views

Inline Template with Render Array in #context

I'm using the https://api.drupal.org/InlineTemplate to render a string with a variable, and that variable is itself another theme function. My reading of the documentation is that this is supported;...
0
votes
0answers
32 views

Variables unavailable in views field template

I'm overriding the default views-view-field.html.twig for a specific field in a view. The template is named: views-view-field--conference_overview--page_1--field_media_oembed_video.html.twig Note: ...
0
votes
1answer
38 views

Add inline style to render array attributes, without XSS filtering

I wish to use an inline style to add a dynamically generated background image URL to a div, e.g. $build[0] = [ '#type' => 'container', '#attributes' => [ 'id' => '...
0
votes
0answers
29 views

Background images for page titles

I want to add background images behind page titles. Aside using css styling to achieve this, is there a more flexible way to have different image-background page title blocks for different pages or ...
2
votes
1answer
32 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
19 views

How do I theme the secondary menu?

The following code allows me to print the secondary menu. <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu'...
0
votes
0answers
25 views

Sub-theme not inheriting CSS

I have checked all the similar questions on here, and the Drupal forums, but to not avail. I followed the Drupal documentation for creating a sub-theme, verbatim, but my new theme is not inheriting ...
1
vote
1answer
52 views

How can I add styles attribute to Global Custom field markup?

I have created a view to display my articles and I would like the article thumbnails to be used as background. So I added the different fields I've hidden. I added a relationship to the image field ...
0
votes
1answer
42 views

How to use text from a block view as a prefix to a node title

What I would like to do In Durpal 7, I am using a block view to display our manufacturers name above our node titles. We added a custom region above content, and that is working fine. However, I ...
0
votes
0answers
18 views

How to choose the flag type display mode?

I created a type of "article" node. A user can flagged the nodes. On the "full" nodes, I want to display the link for flagged and the total number of flag. With the latest version of the module it is ...
0
votes
1answer
43 views

How to count the number of comment and flag in a node?

I want to display on my node the number of comment and flag. What should I add to my TWIG to get this? How to count the number of comment and flag in a node? Here is an example :
1
vote
0answers
33 views

Custom view multiple-value field

What do I need to adjust to make this code work? {% if fields.field_video_video[1].content|striptags|trim is not empty %} {{ fields.field_video_video.content }} {% endif %} The logic is to ...