MODX Community

Testing is a TV holds a value

Hello

I have created three TVs, each of which holds a URL. I display an icon and wrap it in a link using the value in the TV like this:

<div class="text-right">
  <a href="[[*ArtistFacebook]]" target="_blank"><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
  &nbsp;
  <a href="[[*ArtistLinkedIn]]" target="_blank"><i class="fa fa-linkedin-square" aria-hidden="true"></i></a>
  &nbsp;
  <a href="[[*ArtistWebsite]]" target="_blank"><i class="fa fa-desktop" aria-hidden="true"></i></a>
</div>

This works fine. However, I do not want to display the icon if the TV is empty, i.e. it doesn’t contain a URL.

Could anyone advise how I would do this?

Thanks, Tony

You could use a modifier for that:

[[*ArtistFacebook:notempty=`
   <a href="[[*ArtistFacebook]]" target="_blank"><i class="fa fa-facebook-official" aria-hidden="true">/i></a>
`]]

Be advised that using too many modifiers can have an impact on your performance, though.

1 Like

@vibedesign - many thanks. This is a useful feature.

1 Like