This forum is for assistance with theme development.

How do I get the value of a field to do an if statement

Hi

Spent a couple of hours trying to figure out something I assumed would be really easy but I'm not getting it

I have over ridden my views-view-fields.html.twig file and that works fine

I render my fields using {{ fields.uid.content }} and that also works fine

What doesn't is if I try and run an if statement over it. 

fields.uid.0 returns nothing

fields.uid.value also returns nothing

fields.uid causes an error

so how do I do something like 

{% if fields.uid.content == 'John' %} ...

twig template no file name suggestions

I want to change something in twig, but one of my template doesn't have suggestion name.

 THEME DEBUG 
 THEME HOOK: 'views_mini_pager' 
 BEGIN OUTPUT from 'themes/bootstrap/templates/views/views-mini-pager.html.twig' 

I found this code on forum:

Creating an Instagram link list view and template?

If you're not familiar with Instagram, you are allowed one link your bio. A lot of people use products like linkin.bio or linktr.ee as landing page to then link to blog posts. I have a Drupal 8 blog and thought why not solve this problem the Drupal way, so it brings people directly to my site and uses the same theming. But after days of trying out a few different things, I'm at a loss. 

Pager of comments

Hi guys.

How to get a pager of comments in template node.html.twig?

How to display 2 content by clicking on a tab ?

I have a page with 2 tabs.

I want the pills-public tab to display :

PUBLIC BLOCK 1

I want the pills-private tab to display :

PRIVATE BLOCK 2

PRIVATE BLOCK 1

Note that the 2 PRIVATE content is not in the same region.

How to do this ? The code below does not work.

https://codepen.io/anon/pen/JqwJQd

How to change 2 contents with a tab ?

I have a Drupal 8 site and Bootstrap 4.

On my page I have 2 tabs that change the block when clicked.

The first tab displays a single block, but the second tab displays 2 blocks.

The pills-public-tab tab should display :

{{ drupal_view('message_activity_stream_timeline_public', 'block_1') }}

The pills-private-tab tab should display :

Pages

Subscribe with RSS Subscribe to RSS - Theme development