PHP Classes
elePHPant
Icontem

File: src/Cabin/Bridge/View/macros/blog_categories.twig

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  CMS Airship  >  src/Cabin/Bridge/View/macros/blog_categories.twig  >  Download  
File: src/Cabin/Bridge/View/macros/blog_categories.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CMS Airship
Content management system with security features
Author: By
Last change:
Date: 0 years ago
Size: 3,254 bytes
 

Contents

Class file image Download
{% macro frontCatTree(catdata, parentid, this_cargo, can_edit = false, can_delete = false, depth = 0) %}
    <li>{% include this_cargo %}{#
    #}{% if catdata.children %}
    <ul class="blogcat_child">
        {% for child in catdata.children %}
            {{
                _self.frontCatTree(
                    child,
                    catpdata.groupid,
                    this_cargo,
                    can_edit,
                    can_delete,
                    depth + 1
                )
            }}
        {% endfor %}
    </ul>
{% endif %}</li>
{% endmacro %}

{% macro selectBox(catdata, selected, parentid = null, fullpath = "", depth = 0) %}{#
    #}{% if fullpath %}{#
        #}{% set fullpath = fullpath ~ " &rsaquo; " ~ catdata.name %}{#
    #}{% else %}{#
        #}{% set fullpath = catdata.name %}{#
    #}{% endif %}
    {% if not selected or catdata.categoryid != selected %}
        <option
            value="{{ catdata.categoryid|e('html_attr') }}"
            data-ancestors="{{ catdata.ancestors|json_encode }}"
            data-fullpath="{{ fullpath|e('html_attr') }}"
            class="treeselect {#
            #}branch_{{ depth|default(0)|e('html_attr') }}{#
            #}{% if catdata.children %}{#
                #} treeselect_parent{#
            #}{% endif %}"
            {% if catdata.categoryid == selected %}
                selected="selected"
            {% endif %}
        >
            {{ catdata.name }}
        </option>
        {% if catdata.children %}
            {% for child in catdata.children %}
                {% if child.categoryid not in catdata.ancestors %}
                    {{
                        _self.selectBox(
                            child,
                            selected|default(''),
                            catdata.categoryid,
                            fullpath,
                            depth + 1
                        )
                    }}
                {% endif %}
            {% endfor %}
        {% endif %}
    {% endif %}
{% endmacro %}

{% macro nonExclusiveSelectBox(catdata, selected, parentid = null, fullpath = "", depth = 0) %}{#
    #}{% if fullpath %}{#
        #}{% set fullpath = fullpath ~ " &rsaquo; " ~ catdata.name %}{#
    #}{% else %}{#
        #}{% set fullpath = catdata.name %}{#
    #}{% endif %}
    <option
            value="{{ catdata.categoryid|e('html_attr') }}"
            data-ancestors="{{ catdata.ancestors|json_encode }}"
            data-fullpath="{{ fullpath|e('html_attr') }}"
            class="treeselect {#
        #}branch_{{ depth|default(0)|e('html_attr') }}{#
        #}{% if catdata.children %}{#
            #} treeselect_parent{#
        #}{% endif %}"
        {% if catdata.categoryid == selected %}
            selected="selected"
        {% endif %}
    >
        {{ catdata.name }}
    </option>
    {% if catdata.children %}
        {% for child in catdata.children %}
            {{
                _self.nonExclusiveSelectBox(
                    child,
                    selected|default(''),
                    catdata.categoryid,
                    fullpath,
                    depth + 1
                )
            }}
        {% endfor %}
    {% endif %}
{% endmacro %}