kai-jacobsen/kontentblocks

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

Summary

Maintainability
Test Coverage
{% extends Form.getLayout() %}
{% block fieldmarkup %}
    <div class='kb-field-image-wrapper' data-kbfield="image">
        <div class='kb-js-add-image kb-field-image-container'>
            {% if Field.getArg('previewWidth') and Field.getArg('previewHeight') %}
                <img src='{{ image.size(Field.getArg('previewWidth'), Field.getArg('previewHeight')).src() }}'>
            {% else %}
                <img src='{{ image.size('full').src() }}'>
            {% endif %}
        </div>
        <div class="kb-field-image-meta kb-hide ">
            <div class="kb-field-image-title">
                <label>{{ i18n.title }}</label>
                <input class='kb-js-image-title kb-observe' type="text"
                       name='{{ Form.getFieldName( 'title') }}'
                       value='{{ value.title }}'>
            </div>
            <div class="kb-field-image-description">
                <label>{{ i18n.description }}</label>
                <textarea class='kb-js-image-description kb-observe' type="text"
                          name='{{ Form.getFieldName( 'caption') }}'>{{ value.caption }}</textarea>
            </div>
        </div>
        <p class="description">Target Size = W:{{ Field.getArg('width') }}px, H:{{ Field.getArg('height') }}px</p>
        <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>
    </div>
{% endblock %}