This forum is for assistance with theme development.

Help getting rid of excess vertical whitespace

I maintain a module that provides a block with a wall clock embedded – Wallclock. The clock is mainly created in a file called templates/wallclock.html.twig, which consists of some SVG to create the clock and hands. In this template I've put placeholder for some text, which shows as "This string should be placed just below the clock face."  This is how in currently looks if the block with the block is placed inside the main content region:

I want a submenu in the page sidebar.

I want a submenu in the page sidebar.
The menu structure is as follows.

----

Parent_A
 - Child_A1
   - Grandchild_A1-1
   - Grandchild_A1-2
 - Child_A2
 - Child_A3
Parent_B
 - Child_B1
 - Child_B2
 - Child_B3
Parent_C
 - Child_C1
 - Child_C2
 - Child_C3

----

When browsing the page of [Parent_A], the menu I want to display in the sidebar is:
This is the same when displaying the page of [Child_A1] or when displaying [Grandchild_A1-1].

----

For loop in field.html.twig generates parent div for each element instead of one container div

Hi. Please help.

This is my code: 

<div class="mx-6">

{% if multiple %}

<div>

{% endif %}

{% for item in items %}

{# Node content #}

{{ item.content }}

{% endfor %}

{% if multiple %}

</div>

{% endif %}

</div>

output is something like this: 
 

COLOR SCHEME Bartik Drupal version 9.4.5

Does anybody know where disappear COLOR SCHEME in the Bartik theme? 

Previously we could have changed the background color in the Header section through the theme:

  1. Home 
  2.  Administration 
  3.  Appearance 
  4.  Appearance Settings 
  5.  Bartik = Color Scheme

Version 9.4.5 does not have that... :( 

It was very easy to modify background colors in the HEADER. Maybe it is somewhere else? 

Raf.

Changing the Homepage Page Title

Greetings,

  I have Drupal 9.45 installed and need to programmatically change the title tag.  I see in the twig template the field looks like this:

 <title>{{ head_title|safe_join(' | ') }}</title>

But when I try to set that variable in a preprocess function nothing is changing:

function MYTHEME_preprocess_page(&$variables){

      $variables['head_title']['#markup'] = [t('Welcome page')];

}

I've also tried:

$variables['head_title'] = 'Welcome Page';

How to Modify Placement of Elements in a view based of a field selected in the content

I have a content type with 4 fields namely title, body, image, and position, my goal is to set the placement of these fields based on the value selected in the position field e.g. if the value of position is set to 'left' the image is to be shown on the left and the title and body should be shown on the right and vice versa I created a view using all these fields now I want to use the HOOK__views_pre_render to get the value of the position field, and based on that set the position of the elements as given in the example

Pages

Subscribe with RSS Subscribe to RSS - Theme development