This function aims to check two things:
Whether a WebApp has a Detail Layout enabled?
Whether a WebApp Layout has a {{this.full_slug}} which fits an expected pattern.
In future, this function should also be able to provide these checks for Module Layouts too.
Currently, the function is experimental and works well as a straight-out-of-the-box solution for Layouts installed, but we do recommend you also carry out a manual check to make sure links to detial pages are working correctly.
This function fetches the configuration file which Siteglide uses to store metadata about the WebApp or Module. By outputting the returned Object {{table_config}}
you can explore the JSON tree and find out information about the WebApp dynamically.
SiteBuilder Layouts might for example use this to output the name of the WebApp in a Layout, or to loop over custom fields to output the field names as labels alongside the values.
The function carries out a GraphQL call behind the scenes, so for performance reasons, we recommend only including this function if you need it. It may be more appropriate, when you know the data should not change often, to hardcode these values in the Layout instead. Following this, you are also welcome to replace this function where you see it in an installed layout, with a more straightforward hardcoded solution.
However, if you have a situation where the WebApp configuration is likely to change often and you want the layout to automatically change often to reflect that, this function can be very useful.
This function is an important part of how WebApp Layouts can automatically adapt to handle different sources of data.
It takes in a headings object which stores field IDs as keys next to the names of available field slots as values. It then returns a new object using the values in this
which stores the data values against those field slots so that the layout can output the data.
If you add a new field to the WebApp after creating the layout with SiteBuilder, you can safely access that value via the this
object as you normally would in a layout.
However, if you wish, you can also modify the existing headings in the JSON object.
Starting with this Object...
You could change it so that existing {{field_map['Title']}}
outputs would output values from a different field like so:
Or you can add a brand new slot to the WebApp {{field_map['Extra Slot']}}
and populate it with a new field's data:
As the field_headings are passed into the function, the function will return an object where the required data values are stored against the correct keys.
In this section of the documentation, we'll cover some common Liquid functions which SiteBuilder adds into Layouts so you can understand what this code is doing and, if you like, use them yourself.
A Liquid function is similar to an include
tag except that they return a single variable instead of printing to the page. They are also close to being "pure" functions in that they do not inherit variables other than the ones you pass to them explicitly inside the tag, making them more reliable and less prone to unexpected side-effects.
Read more about Liquid functions here: Liquid Functions.
These functions can be modified by future versions of SiteBuilder. The /v1/
in the path will be updated for newer versions of the functions. Newly installed Layouts will use the new version, but your existing code can continue to use the older versions, for backwards compatibility.