{% block toolbar %}
    {% set icon %}
    <a href="{{ url("webprofiler.dashboard", {profile: token}, {fragment: 'forms'}) }}" title="{{ 'Forms'|t }}">
        <img width="21" height="28" alt="{{ 'Forms'|t }}"
             src="data:image/png;base64,{{ collector.icon }}">
        <span class="sf-toolbar-info-piece-additional sf-toolbar-status">{{ collector.getFormsCount }}</span>
    </a>
    {% endset %}
    {% set text %}
    {% spaceless %}
        <div class="sf-toolbar-info-piece">
            {% for keys, form in collector.getForms %}
                <b>{{ keys }}</b>
                <div><a href="{{ idelink(form.class.file, form.class.line)|raw }}">{{ abbr(form.class.class)|raw }}
                        ::{{ form.class.method }}</a></div>
            {% endfor %}
        </div>
    {% endspaceless %}
    {% endset %}

    <div class="sf-toolbar-block">
        <div class="sf-toolbar-icon">{{ icon|default('') }}</div>
        <div class="sf-toolbar-info">{{ text|default('') }}</div>
    </div>
{% endblock %}

{% block panel %}
    <script id="forms" type="text/template">
        <h2 class="panel__title">{{ 'Forms'|t }}</h2>
        <% if( data.forms && data.forms.length != 0){ %>
            <% _.each( data.forms, function( item, key ){ %>
                <div class="panel__container">

                    <ul class="list--inline">
                        <li><b>ID</b> <%= key %></li>
                        <li><b>class</b> <%= Drupal.webprofiler.helpers.classLink(item.class) %></li>
                    </ul>

                    <table class="table--compact">
                        <thead>
                        <tr>
                            <th>{{ 'form'|t }}</th>
                            <th>{{ 'title'|t }}</th>
                            <th>{{ 'access'|t }}</th>
                            <th>{{ 'type'|t }}</th>
                        </tr>
                        </thead>
                        <tbody>
                        <% _.each( item.form, function( value , key ){ %>
                        <tr>
                            <td><%= key %></td>
                            <td><% if(value['#title'] == null ){ %> {{ '-' }} <% } else { %> <%= value['#title'] %><% } %></td>
                            <td><% if(value['#access'] == null ){ %> {{ 'null' }} <% } else { %> <%= value['#access'] %><% } %></td>
                            <td><% if(value['#type'] == null ){ %> {{ 'null' }} <% } else { %> <%= value['#type'] %><% } %></td>
                        </tr>
                        <% }); %>
                        </tbody>
                    </table>
                </div>
            <% }); %>
        <% } else { %>
            <div class="panel__container">
                <p>{{ 'No results'|t }}</p>
            </div>
        <% } %>
    </script>
{% endblock %}
