Guest User

Untitled

a guest
Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. {{ entry.matrixField.type('copy').nth(0).plainText }}
  2.  
  3. {% if craft.request.isLivePreview %}
  4. {% set firstCopyBlock = null %}
  5. {% for block in entry.matrixField %}
  6. {% if firstCopyBlock == null and block.type.handle == 'copy' %}
  7. {% set firstCopyBlock = block %}
  8. {% endif %}
  9. {% endfor %}
  10. {% else %}
  11. {% set firstCopyBlock = entry.matrixField.type('copy').first() %}
  12. {% endif %}
  13.  
  14. {% if firstCopyBlock %}
  15. {{ firstCopyBlock.plainText }}
  16. {% endif %}
  17.  
  18. {% if craft.app.request.isLivePreview %}
  19. {% set firstCopyBlock = null %}
  20. {% for block in entry.matrixField.all() %}
  21. {% if firstCopyBlock == null and block.type.handle == 'copy' %}
  22. {% set firstCopyBlock = block %}
  23. {% endif %}
  24. {% endfor %}
  25. {% else %}
  26. {% set firstCopyBlock = entry.matrixField.type('copy').one() %}
  27. {% endif %}
  28.  
  29. {% if firstCopyBlock %}
  30. {{ firstCopyBlock.plainText }}
  31. {% endif %}
Add Comment
Please, Sign In to add comment