This forum is for assistance with theme development.

Getting URL in Media Fields

Hi! I trying to get URL in Media Fields but I can´t.

I have a content type created with 2 fields, a MEDIA field (for video) and another IMAGE.

I am able to get the image url with: file_url(paragraph.field_local_img.entity.uri.value)

But I want to check if the URL of the MEDIA (Video) is empty and it doesn't works the same way.

How can I get the value of the Media URL?

Thx

How do I find out where a twig variable is coming from?

In Drupal, I need to change the output of a template. I'm curious where I can find out this variable chat or phone is originating from?  Is this field from a content type?

{% if chat or phone%}
<ul class="utilities-list no-bullet clearfix">

Print fields of content of a referenced entity field in paragraph template

I currently have the following scenario:

There is an entity reference field in my paragraph, in which you can select a content of a certain type. I now need to print fields of the content referenced in that field in my paragraph template.

I have not yet managed to get any field printed. 

I have tried the following with field_reference being the entity reference field in the paragraph:

{{ content.field_reference.0.entity.title }}

{{ content.field_reference.entity.title.value }}

and variations of it but nothing rendered anything.

How do I target a specific Node/Page with if statement in twig?

In my page.html.twig template, I am using this if statement:

{% if not is_front %}
to add an iframe.
This works for all internal pages, however I only want it to display on 1 particular page of the site.
What if statement would I use to allow something within the page.html.twig template to only show on a certain page?

twig tweak...Solved - altered core/core.services.yml

Hi All,

I have been banging my head against a wall for 2 days trying to solve this. 

I have a local apache lamp stack using PHP 7.4.3 with apache and virtual hosting turned on.

The site that I am trying to turn twig tweak on with is a Drupal 8.9.13 site.  Its essentially a migration from Drupal 7 which I am trying to upgrade to D8.  I have gone about the usual things: 

Dynamic nid for drupal_field twig tweak function

I have a field_slides paragraph field on my home page, on drupal 9.1.3. It is for rendering a carousel. I want to iterate over the elements of the paragraph field (eg the slides with title, description and button fields). I'm using drupal_field twig tweak function for the sake of translability. I have tried something like the following :

Pages

Subscribe with RSS Subscribe to RSS - Theme development