Lava Shortcode support for twopass

Lava Shortcode support for twopass


The twopass option on Lava Cache allows for secondary processing of Lava.  Could similar functionality be added to Lava shortcodes?

This would allow one to pass Lava within blockContent and have that Lava rendered/processed in the shortcode, rather than before.

For example, if I had a shortcode called pastor, for accessing pastor Persons from a group (GroupMembers, rather).  And, my pastor Group had a Ministries attribute.  For example, something like this:

{% assign pastorGroupId = 1354 %}
{% groupmember where:'GroupId == {{ pastorGroupId }} && GroupMemberStatus == "Active"' %}
{% for gm in groupmemberItems %}
  {% assign inMinistry = gm | Attribute:'Ministries' | Split:',' | Contains:ministry %}
  {% if inMinistry %}
    {% assign Pastor = gm.Person %}
    {{ blockContent }}
  {% endif %}
{% endfor %}
{% endgroupmember %}

Now I could use that shortcode as follows (note the {% raw %} protects the Lava from the first pass):

<h3>Childrens Pastors<h3>

{[ pastor ministry:'Childrens' twopass:'true' ]}
  {% raw %}
  <b>{{ Pastor.FullName }}</b><br>
  <a href="mailto:{{ Pastor.Email }}">{{ Pastor.Email }}</a>
  {% endraw %}
{[ endpastor ]}

This could be very useful for using shortcodes to create reusable functions for building various pieces of the site.

Note - this differs from the Lava in the shortcode because you could reuse this shortcode in different aspects of the site differently.  For example, on one area, you may want to list the Pastors and their mobile numbers (say on an Emergency page), and on another page in your site, you may want to list the pastors' pictures and name without any contact info, etc.

Photo of Steve Lipinski Submitted by Steve Lipinski, First Church of God of Columbia City  ·   ·  Lava
Login to add a comment...