kai-jacobsen/kontentblocks

View on GitHub
core/Fields/Definitions/templates/image/default.twig

Summary

Maintainability
Test Coverage
{% extends Form.getLayout() %}
{% block fieldmarkup %}
    <div class='kb-field-image-wrapper' data-kbfield="image">
        <div tabindex="0" aria-label="Datei auswählen für: {{ Field.getArg('label') }}" role="button" class='kb-js-add-image kb-field-image-container'>
            {% if (Field.getArg('width')) %}
                <img src='{{ image.size(Field.getArg('width'),Field.getArg('height')).src() }}'>
            {% else %}
                <img src='{{ image.size('thumbnail').src() }}'>
            {% endif %}
        </div>
        <div class="kb-field-image-meta {% if Field.getArg('hideMeta') %} kb-hide {% endif %}">
            <div class="kb-field-image-title">
                <label>{{ i18n.title }}</label>
                <input class='kb-js-image-title kb-observe' type="text" aria-label="Titel Attribut für:{{ Field.getArg('label') }}"
                       name='{{ Form.getFieldName( 'title') }}'
                       value='{{ value.title }}'>
            </div>
            <div class="kb-field-image-description">
                <label>{{ i18n.description }}</label>

                <textarea aria-label="Besschreibung für: {{ Field.getArg('label') }}" class='kb-js-image-description kb-observe' type="text"
                          name='{{ Form.getFieldName( 'caption') }}'>{{ value.caption }}</textarea>
            </div>
        </div>
        <input class='kb-js-image-id' type='hidden' name='{{ Form.getFieldName('id') }}' value='{{ value.id }}'>
        {#<input class='kb-js-image-alt' type='hidden' name='{{ Form.getFieldName( 'details', 'id' ) }}'#}
        {#value='{{ value.details.alt }}'>#}
    </div>

    <div class="kb-field-image--footer">
        <a class="button kb-js-reset-image">Reset</a>
        {% if Field.getArg('showcrop', false) %}
            {% include 'image/_cropselect.twig' %}
        {% endif %}
    </div>
{% endblock %}