JsonMenu
THIS TYPE OF ELAsTICMS FILED IS DEPRECATED, SEE JSON MENU NESTED FIELD.
JsonMenuStructure is a kind of elasticms field serializing a JSON in a string. That JSON has a specific structure. It's an array of JsonMenuItem; A JsonMenuItem has the following fields:
id: contain a unique id (string) for the JsonMenuItem (unique in the structure only)label: contain a non-mandatory string labelling the JsonMenuItetype: string identifying the subform type of this JsonMenuItemobject: contain the JSON of the subformchildren: contains a non-mandatory array of JsonMenuItem (recursive structure)
Twig filter ems_json_menu_decode
With this filter you can parse a JsonMenu field and get a JsonMenu object
JsonMenu object
Generate a breadcrumb
JsonMenu contains a breadcrumb method useful in order to generate breadcrump:
twig
{% if pageInStructure %}
{% set structure = attribute(pageInStructure.structure, 'structure_'~locale)|default('{}')|ems_json_menu_decode %}
{% if attribute(structure, 'breadcrumb') is defined %}
{% for item in structure.breadcrumb(pageInStructure.uid) %}
<li class="breadcrumb-item">
{% if attribute(paths, [pageInStructure.sid, item.id]|join(':'))|default(false) %}
<a href="{{ path('match_all', {path: attribute(paths, [pageInStructure.sid, item.id]|join(':')) }) }}">
{{ item.label }}
</a>
{% else %}
{{ item.label }}
{% endif %}
</li>
{% endfor %}
{% else %}
<li class="breadcrumb-item">Please update to skeleton 3.7.8 to get a breadcrumb</li>
{% endif %}
{% endif %}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
