This forum is for assistance with theme development.

changed values in pre-process hook are not getting reflected in twig

Hi 

I am new to Drupal theming. I have a scenario where 
I need to toggle the Left Menu display based on user action via Javascript. 

Which means, 
(1) Left Menu should be hide with out page refresh, 
(2) if I hide Left Menu in page-1 and navigate to page-2, in  page-2 Left Menu should not be visible.

to achive this, i created a cookie via javascript under path '/'.

and reading the cookie and storing that cookie value in a variable in theme_prepprocess_page()

based on the variable value in the twig template hiding the Left Menu. 

How to check if current page is a contact form?

In page.html.twig, I want to have a different sized column (bootstrap theme).

For that, I wanted to know if current page is a contact page or not. And, for taxonomy too.

In twig, I tried: url('<current>'), which gives me current URL.

But, when I tried twig string functions like:

{% if url('<current>') ends with 'contact' %}

I tried "in" too. But, every function returns false.

Is there any better way to know if current page is contact/taxonomy page?

Cache issues when using Boolean in views

I'm using boolean values to try to control whether content shows on some pages - admins simply click a check box which should then allow content to show on a page.  Issue is that the content is only changing on the front end after I flush the caches.  

The boolean value is being checked in filter criteria in a view. 

Any ideas on where I'm going wrong / how I can get content to change on the front end without a manual cache flush? 

I cant find place to change one of the structure/block

Welcome

Iv got some important information on content in 1st start page that is showing only for guest. But i cant found where can i change it.. i done it lottime ago when i was configure site but now im confused and still cant found where should i have it.

Its saying - > Access denied You are not authorized to access this page.

Site code placemante -

<div id="main" class="grid_8">  

The YAML value does not appear to be valid UTF-8.

When I went to clear my cache on my Drupal 8.5.3 site using Drush, I got the above-referenced error message. I was able to clear the cache through the menu system, but this slows me down.

After doing some research, it appears that this is a symphony problem with a simple solution of changing the yaml files to UTF-8. So, I went into Notepad++ and opened my *.info.yml and *.libraries.yml to see if they were encoded in a different format. Nope, they were both UTF-8.

Has anyone else encountered this error and/or can someone lead me in the right direction?

Steve

Drupal 8 block twig file with {{ kint(content['_field_layout']) }} forces redirect to install page

Using a block twig template file, I'm trying to output the value of a block field called "field_link". If I add  {{ kint(content) }}, clear cache and reload the page, I then see an enormous array and see  an element called ['_field_layout'], then one called ['first’], then under that, a "field_link". That sounds promising, but I don't see url data yet, so I tried then to output  {{ kint(content['_field_layout']) }} to see if I could get more specific and detailed data. I cleared cache, then returned to the page, and it forces a load of the drupal installation page.

Pages

Subscribe with RSS Subscribe to RSS - Theme development