{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% block sonata_media_type_widget %}
    <div class="row">
        <div class="col-md-4 pull-left">
            {% if value is not null and value.providerReference %}
                {% if sonata_admin_enabled is defined and sonata_admin_enabled and sonata_admin.admin is not same as(false) %}
                    <a href="{{ sonata_admin.admin.getConfigurationPool().adminByAdminCode('sonata.media.admin.media').generateObjectUrl('edit', value) }}">
                        <strong>{{ value.name }}</strong>
                    </a>
                {% else %}
                    <strong>{{ value.name }}</strong>
                {% endif %}
            {% else %}
                <strong>{{ 'no_linked_media'|trans({}, 'SonataMediaBundle') }}</strong>
            {% endif %}
        </div>

        <div class="col-md-3 pull-left"><strong>{{ 'widget_headline_information'|trans({}, 'SonataMediaBundle') }}</strong></div>
        <div class="col-md-2 pull-left"><strong>{{ 'link_media'|trans({}, 'SonataMediaBundle') }}</strong></div>
    </div>
    <div class="row">
        <div class="col-md-4 pull-left">
            {% if value is not null and value.providerReference %}
                <div class="pull-left" style="margin-right: 5px">
                    {{ sonata_thumbnail(value, 'admin', {'class': 'img-polaroid media-object'}) }}
                </div>
            {% else %}
                <div class="pull-left" style="margin-right: 5px">
                    <img src="{{ asset('bundles/sonatamedia/grey.png') }}" class="img-polaroid media-object" style="width: 85px; height: 85px"/>
                </div>
            {% endif %}
        </div>
        <div class="col-md-3 pull-left">
            {% if value is not null and value.providerReference %}
                <strong>{{ 'widget_label_type'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ value.providerName|trans({}, 'SonataMediaBundle') }}</span>
                <br/>
                <strong>{{ 'widget_label_context'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ value.context|trans({}, 'SonataMediaBundle') }}</span>
            {% else %}
                <strong>{{ 'widget_label_type'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ form.vars['provider']|trans({}, 'SonataMediaBundle') }}</span>
                <br/>
                <strong>{{ 'widget_label_context'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ form.vars['context']|trans({}, 'SonataMediaBundle') }}</span>
            {% endif %}
        </div>
        <div class="col-md-2 pull-left">
            {{ block('form_widget') }}
        </div>
    </div>
{% endblock sonata_media_type_widget %}
