Getting Gallery Cover from Template Variable in MODX

There is a case where the gallery's cover needs to be listed alongside the pagetitle of resources, where the gallery is connected by a Template Variable.


If you don't know how to add this type of Template Variable, just create a TV, and select "galleryalbumlist" as its Input Type.

Now, the problem is that there no snippet to pull out the value of the TV into the list.


Example of listing the resources:

Snippet call:

<nav class="menu">

pdoMenuHoverImage chunk:

<a href="[[+link]]" [[+attributes]]>[[+menutitle]]</a>[[+wrapper]] [[!getGalleryCoverByTV?
<img src="[[+getGalleryCoverByTV]]" class="dass-project-nav-image is-hidden">

So, this is the custom snippet for it.


Output example:



blog comments powered by Disqus