-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entry-show: better display for checkbox tree
- Loading branch information
Showing
2 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{% extends "@bazar/layouts/field.twig" %} | ||
|
||
{% block value_container %} | ||
<span class="BAZ_texte field-checkbox-tree"> | ||
{{ _self.renderNodes(treeValues) }} | ||
</span> | ||
{% endblock %} | ||
|
||
{% macro renderNodes(nodes) %} | ||
|
||
{# Add some classes "leaf", "only-leafs", "one-child" to make customization with CSS easy #} | ||
{% set allChildrenEmpty = true %} | ||
{% for node in nodes %} | ||
{% if node.children is not empty %} | ||
{% set allChildrenEmpty = false %} | ||
{% endif %} | ||
{% endfor %} | ||
<ul class="{{ allChildrenEmpty ? 'only-leafs' : ''}}"> | ||
{% for node in nodes %} | ||
<li class="{{ node.children|length == 0 ? 'leaf' : ''}} {{ node.children|length == 1 ? 'one-child' : ''}}"> | ||
{{ node.label|raw }} | ||
{% if node.children|length > 0 %} | ||
{{ _self.renderNodes(node.children) }} | ||
{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endmacro %} | ||
|
||
|
||
|
||
|