a713f93eb1
a713f93eb1

Reputation: 69

How to require 2 conditions

In a twigtemplate with Drupal 8, I have a view.

I want this view to be displayed only if it has a result and if the current user is logged in.

I tested the code below but it doesn't work :

{% if logged_in and if view > 0 %}

Upvotes: 1

Views: 54

Answers (2)

Mching
Mching

Reputation: 66

Try this:

{% if logged_in and view > 0 %}

You don't have to put it in parentheses.

Upvotes: 3

Chetan Patel
Chetan Patel

Reputation: 782

The condition should be :

{% if logged_in and (view > 0) %}

Upvotes: 1

Related Questions