Entity references are widely used in drupal to link to other entity objects. In this case I had to loop over them in Twig to get a string with their id's, divided by a plus sign. Here is the snippet:

{% set ids = '' %}
{% for key, value in paragraph.field_popup_reference.value %}
  {% if key > 0 %}
    {% set ids = ids ~ '+' ~ value.target_id %}
  {% else %}
    {% set ids = value.target_id %}
  {% endif %}
{% endfor %}

 


Saved you some valuable time?

Donate and get more free time-saving code on this website in the future.