I am using the following code in the templates of the home page of my site, to make the display mode frontpage_tasks for the current user's account. It works perfectly :

{{ drupal_entity('user', user.id, 'frontpage_tasks') }}

I want to make the same display mode for the current user's stores and groups. I tried the code below but it doesn't work :

{{ drupal_entity('commerce_store', user.id, 'frontpage_tasks') }}

and

{{ drupal_entity('group', user.id, 'frontpage_tasks') }}

How do I make the current user's entities on the home page ?

Comments

zenimagine created an issue. See original summary.

chi’s picture

I do not understand what you are trying to achive. The first argument of of the drupal_entity() is entity type while the second argument is ID of a particular entity of that type. So if you specify 'commerce_store' as the fist argument you should provide ID of some commerce store for the second argument.

zenimagine’s picture

OK, so it is not possible to show all stores and groups of the current user on the homepage with Twig Tweak ?

chi’s picture

Right. That should be possible with Views module.

zenimagine’s picture

The problem is that the Views module adds a lot of unnecessary markup that makes it impossible to display it correctly.

I just want to make the display mode, without any additional tags

chi’s picture

Then build that list in preprocess yourself. Maybe Commerce module provides some API function for that.

zenimagine’s picture

ok thank you

zenimagine’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.