I'm new to using craft cms and have been using this site to answer several questions. I decided I should give back. I have been using the Embedded Assets plugin but could not figure out the "for loop" code in a Matrix field to display links to all selected YouTube videos.

  • Is this a question or an answer?
    – Alex Roper
    Sep 16, 2019 at 8:40
  • Sorry, I should clarify. It looks like your code example above is correct. If you want to contribute an answer, can you move the answer to the field below and rephrase your question as someone else might ask (e.g. How do I...)? See Can I answer my own question?
    – Alex Roper
    Sep 17, 2019 at 22:16
  • Thank you. This is my first Question/Answer on StackOverflow.
    – ChrisE
    Sep 18, 2019 at 1:01

1 Answer 1


This is one part of a bigger switch case statement for a Craft Matrix field.

  • My block is called newFeatureVideo.
  • my field is called video.
{% case "newFeatureVideo" %}
  {% for items in block.video.all() %}
    {% set item = craft.embeddedAssets.get(items) %}
    <li><a href="{{ item.url }}">{{ item.title }}</a></li>
  {% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.