kai-jacobsen/kontentblocks

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

Summary

Maintainability
Test Coverage
{% extends Form.getLayout() %}
{% block fieldmarkup %}
    <label for='{{ Form.getInputFieldId('link') }}'>{{ i18n.linklabel }}</label><br>
    <input type='text' data-kbf-link-url class='kb-js-link-input regular' id='{{ Form.getInputFieldId() }}'
           name='{{ Form.getFieldName('link') }}' placeholder='{{ Form.getPlaceholder() }}'
           value='{{ Field.getValue('link') }}'/>
    <a class='button kb-js-add-link'>{{ i18n.addLink }}</a>

    {% if Field.getArg('linktext', true) %}
        <div class='kb-field--link-meta'><label for='{{ Form.getInputFieldId('linktext') }}'>{{ i18n.linktext }}</label><br>
            <input type='text' data-kbf-link-linktext class='kb-field--link-linktext'
                   id='{{ Form.getInputFieldId('linktext') }}'
                   value='{{ Field.getValue('linktext') }}' name='{{ Form.getFieldName('linktext') }}'>
        </div>
    {% endif %}

    {% if Field.getArg('linktitle') %}
        <div class='kb-field--link-meta'><label
                    for='{{ Form.getInputFieldId('linktitle') }}'>{{ i18n.linktitle }}</label><br>
            <input type='text' class='kb-field--link-linktitle' id='{{ Form.getInputFieldId('linktitle') }}'
                   value='{{ Field.getValue('linktitle') }}' name='{{ Form.getFieldName('linktitle') }}'>
        </div>
    {% endif %}

    {% if Field.getArg('showtarget') %}
        <div class='kb-field--link-meta'>
            <label for='{{ Form.getInputFieldId(false,'target') }}'>
                <input data-kbf-link-target type='checkbox' class='kb-field--link-target'
                       id='{{ Form.getInputFieldId(false,'target') }}'
                        {{ checked(Field.getValue('target'), true) }}
                       value='{{ Field.getValue('target') }}' name='{{ Form.getFieldName('target') }}'>
                {{ i18n.linktarget }} </label>
        </div>
    {% endif %}
{% endblock %}