{#
    MetaTag form macro

    @author Elze Kool <info@visualmedia.nl>
#}
{% macro meta_tag_widget(meta_tag_form, data_fields) %}

    <div class="row meta-tag" data-tag-set="{{ meta_tag_form.vars.value.metaTagPreset.metaTagSet.id }}">
        {{ form_widget(meta_tag_form.metaTagPreset) }}
        <div class="col-sm-11">
            <div class="row">
                <div class="col-sm-12">
                    {% if meta_tag_form.inhoud is defined or meta_tag_form.zichtbaar is defined %}
                        <h4>
                            {{ meta_tag_form.vars.value.metaTagPreset.titel }}
                            {% if meta_tag_form.vars.value.autoAdded %}
                                <small class="text-danger">{{ 'meta_tag.auto_added'|trans({}, 'forms') }}</small>
                            {% endif %}
                        </h4>
                        <hr />
                    {% else %}
                        <h4>
                            {{ meta_tag_form.vars.value.metaTagPreset.titel }}
                            {% if meta_tag_form.vars.value.autoAdded %}
                                <small class="text-danger">{{ 'meta_tag.auto_added'|trans({}, 'forms') }}</small>
                            {% endif %}
                            <small>Inhoud/Zichtbaar niet aanpasbaar, wijzig deze in de tagset</small>
                        </h4>
                    {% endif %}
                </div>
            </div>
            {% if meta_tag_form.inhoud is defined or meta_tag_form.zichtbaar is defined %}
                <div class="row">
                    {% if meta_tag_form.inhoud is defined %}
                        <div class="col-sm-5">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="form-group">
                                        {{ form_label(meta_tag_form.inhoud) }}
                                        <label class="checkbox">
                                            {{ meta_tag_form.inhoudIsExpression.vars.label|trans({}, 'forms') }}{{ form_widget(meta_tag_form.inhoudIsExpression, { attr : { 'data-toggle-codemirror' : meta_tag_form.inhoud.vars.id } }) }}
                                        </label>
                                        {{ form_widget(meta_tag_form.inhoud) }}
                                        <div class="errors">{{ form_errors(meta_tag_form.inhoud) }}</div>
                                        <div class="help-block" data-show-on="{{ meta_tag_form.inhoudIsExpression.vars.id }}">
                                            {{ render(url('manage_meta_tag_available_fields')) }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-1">&nbsp;</div>
                    {% endif %}

                    {% if meta_tag_form.zichtbaar is defined %}
                        <div class="col-sm-5">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="form-group">
                                        {{ form_label(meta_tag_form.zichtbaar) }}

                                        <label class="checkbox">
                                            {{ meta_tag_form.zichtbaarIsExpression.vars.label|trans({}, 'forms') }}{{ form_widget(meta_tag_form.zichtbaarIsExpression, { attr : { 'data-toggle-codemirror' : meta_tag_form.zichtbaar.vars.id } }) }}
                                        </label>

                                        <div data-show-on="{{ meta_tag_form.zichtbaarIsExpression.vars.id }}">
                                            {{ form_widget(meta_tag_form.zichtbaar) }}
                                            <div class="errors">{{ form_errors(meta_tag_form.zichtbaar) }}</div>
                                            <div class="help-block" data-show-on="{{ meta_tag_form.zichtbaarIsExpression.vars.id }}">
                                                {{ render(url('manage_meta_tag_available_fields')) }}
                                            </div>
                                        </div>

                                        <div data-hide-on="{{ meta_tag_form.zichtbaarIsExpression.vars.id }}">
                                            {{ form_widget(meta_tag_form.zichtbaarSelect) }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endif %}
                </div>
            {% endif %}
        </div>
    </div>

{% endmacro %}