Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AllBundles] Configure asset packages and add package to asset call #2776

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ public function prepend(ContainerBuilder $container)

// NEXT_MAJOR: Remove templating dependency

$frameworkExtensionConfig = [
'assets' => [
'packages' => [
'media' => null,
],
],
];
$container->prependExtensionConfig('framework', $frameworkExtensionConfig);

$configs = $container->getExtensionConfig($this->getAlias());
$this->processConfiguration(new Configuration(), $configs);
}
Expand Down
1 change: 1 addition & 0 deletions src/Kunstmaan/AdminBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"kunstmaan/utilities-bundle": "^5.9|^6.0",
"symfony/swiftmailer-bundle": "^2.3|^3.0",
"symfony/acl-bundle": "^1.0|^2.0",
"symfony/asset": "^3.4|^4.4",
"symfony/cache": "^3.4|^4.4",
"symfony/config": "^3.4|^4.4",
"symfony/console": "^3.4|^4.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{% if resource is defined and resource is not null %}
{% if not resource.isNull() %}
{% if resource.url is defined and resource.url is not null %}
{% set href = host ~ resource.url %}
{% set href = asset(resource.url, 'media') %}
{% else %}
{% set href = host ~ form_submission_webdir ~ resource.fileName %}
{% set href = asset(host ~ form_submission_webdir ~ resource.fileName, 'media') %}
{% endif %}
<a target="_blank"
href="{{ href }}">{{ resource.fileName }}</a>
<a target="_blank" href="{{ href }}">{{ resource.fileName }}</a>
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="submenu__item">
<a href="{{ path('_slug', { 'url': item['nt'].url }) }}" class="submenu__link">
{% if item['page'].menuImage is defined and item['page'].menuImage is not empty %}
<img src="{{ item['page'].menuImage.url|imagine_filter('optim') }}" alt="" class="submenu__img">
<img src="{{ asset(item['page'].menuImage.url|imagine_filter('optim'), 'media') }}" alt="" class="submenu__img">
{% endif %}
<h2 class="submenu__title">{{ item['nt'].title }}</h2>
{% if item['page'].menuDescription is defined and item['page'].menuDescription %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<figure class="header-visual">
{% if resource.backgroundImage is not empty %}
<img src="{{ asset(resource.backgroundImage.url|imagine_filter('optim')) }}" class="header-visual__img">
<img src="{{ asset(resource.backgroundImage.url|imagine_filter('optim'), 'media') }}" class="header-visual__img">
{% endif %}

<figcaption class="header-visual__content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<figure class="col-sm-6 service-pp__image">
{% if resource.image is not empty %}
<img src="{{ asset(resource.image.url|imagine_filter('optimpng')) }}" alt="{{ resource.title }}">
<img src="{{ asset(resource.image.url|imagine_filter('optimpng'), 'media') }}" alt="{{ resource.title }}">
{% endif %}
</figure>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
{% endif %}
</p>
<p class="sub-footer__credentials">
Created by <a href="http://www.kunstmaan.be" class="sub-footer__credentials__link"><img src="/frontend/img/general/logo-kunstmaan.svg" alt="Kunstmaan" class="sub-footer__credentials__img"></a>
Created by <a href="http://www.kunstmaan.be" class="sub-footer__credentials__link"><img src="{{ asset('/frontend/img/general/logo-kunstmaan.svg') }}" alt="Kunstmaan" class="sub-footer__credentials__img"></a>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getRootNodeMenuItem() %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/demosite/logo-thecrew.svg" alt="The Crew" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/demosite/logo-thecrew.svg') }}" alt="The Crew" class="main-header__logo__img">
</a>


Expand Down Expand Up @@ -52,7 +52,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getNodeByInternalName('homepage') %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/demosite/logo-thecrew.svg" alt="The Crew" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/demosite/logo-thecrew.svg') }}" alt="The Crew" class="main-header__logo__img">
</a>


Expand Down Expand Up @@ -121,7 +121,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getNodeByInternalName('homepage') %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/general/logo-kunstmaan.svg" alt="Kunstmaan" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/general/logo-kunstmaan.svg') }}" alt="Kunstmaan" class="main-header__logo__img">
</a>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endif %}

<p class="download-pp">
<a href="{{ absolute_url(asset(resource.media.url)) }}" target="_blank" class="download">{{ name }}</a>
<a href="{{ absolute_url(asset(resource.media.url, 'media')) }}" target="_blank" class="download">{{ name }}</a>
<span>| {{ resource.media.contentTypeShort }} {{ resource.media.getFileSize() }}</span>
</p>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
{% set imgUrl = '' %}

{% if type in ['svg', 'gif'] %}
{% set imgUrl = absolute_url(asset(image)) %}
{% set imgUrl = absolute_url(asset(image, 'media')) %}
<img src="{{ imgUrl }}"{% if altText %} alt="{{ altText }}"{% endif %} />
{% else %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type)) %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type)) %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type)) %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type)) %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type), 'media') %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type), 'media') %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type), 'media') %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type), 'media') %}
{% set srcSet = imgUrl_small ~ ' 400w, ' ~ imgUrl_medium ~ ' 600w, ' ~ imgUrl_big ~ ' 1200w, ' ~ imgUrl_huge ~ ' 2400w' %}

{#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
{% set imgUrl = '' %}

{% if type in ['svg', 'gif'] %}
{% set imgUrl = absolute_url(asset(image)) %}
{% set imgUrl = absolute_url(asset(image, 'media')) %}
<img class="video-pp__link__img" src="{{ imgUrl }}"{% if altText %} alt="{{ altText }}"{% endif %} />
{% else %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type)) %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type)) %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type)) %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type)) %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type), 'media') %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type), 'media') %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type), 'media') %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type), 'media') %}
{% set srcSet = imgUrl_small ~ ' 400w,' ~ imgUrl_medium ~ ' 600w,' ~ imgUrl_big ~ ' 1200w,' ~ imgUrl_huge ~ ' 2400w'%}

<img class="video-pp__link__img" srcset="{{ srcSet }}"{% if altText %} sizes="100vw" alt="{{ altText }}"{% endif %}/>
Expand All @@ -27,7 +27,7 @@
{% set videoImage = asset('frontend/img/general/video-pp--default.svg') %}
{% set imageType = 'jpg' %}
{% if resource.thumbnail is not empty %}
{% set videoImage = asset(resource.thumbnail.url|imagine_filter('optim')) %}
{% set videoImage = asset(resource.thumbnail.url|imagine_filter('optim'), 'media') %}
{% set imageType = resource.thumbnail.originalFilename|lower|split('.')|last %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
{% elseif key == 'link' %}
<a href="{{ "{{ resource." ~ fieldArray['url']['fieldName'] ~ "|replace_url }}" }}" {{ "{% if resource." ~ fieldArray['new_window']['fieldName'] ~ " %}target=\"_blank\"{% endif %}" }}>{{ "{{ resource." ~ fieldArray['text']['fieldName'] ~ " }}" }}</a>
{% elseif key == 'image' %}
{{ "{% if resource." ~ fieldArray['image']['fieldName'] ~ " is not empty %}" }}<img src="{{ "{{ asset(resource." ~ fieldArray['image']['fieldName'] ~ ".url) }}" }}" {{ "{% if resource." ~ fieldArray['alt_text']['fieldName'] ~ " is not empty %}" }}alt="{{ "{{ resource." ~ fieldArray['alt_text']['fieldName'] ~ " }}" }}"{{ "{% endif %}" }} />{{ "{% endif %}" }}
{{ "{% if resource." ~ fieldArray['image']['fieldName'] ~ " is not empty %}" }}<img src="{{ "{{ asset(resource." ~ fieldArray['image']['fieldName'] ~ ".url, 'media') }}" }}" {{ "{% if resource." ~ fieldArray['alt_text']['fieldName'] ~ " is not empty %}" }}alt="{{ "{{ resource." ~ fieldArray['alt_text']['fieldName'] ~ " }}" }}"{{ "{% endif %}" }} />{{ "{% endif %}" }}
{% elseif key == 'media' %}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<a href="{{ "{{ asset(resource." ~ fieldArray[0]['fieldName'] ~ ".url) }}" }}">{{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ ".name }}" }}</a>{{ "{% endif %}" }}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<a href="{{ "{{ asset(resource." ~ fieldArray[0]['fieldName'] ~ ".url, 'media') }}" }}">{{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ ".name }}" }}</a>{{ "{% endif %}" }}
{% elseif key == 'single_ref' %}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<div>{{ fieldArray[0]['targetEntity'] }}: {{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ " }}" }}</div>{{ "{% endif %}" }}
{% elseif key == 'multi_ref' %}
Expand All @@ -30,4 +30,4 @@
<div>{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " %}{{ resource." ~ fieldArray[0]['fieldName'] ~ "|date(\"Y-m-d H:i:s\") }}{% endif %}" }}</div>
{% endif %}
{% endfor %}{% endfor %}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% set cke = (app.request and app.request.get('CKEditorFuncNum')) %}
{% set path = "[%s]" | format("M" ~ item.id) %}
<a data-thumb-path="{{ thumbnailurl }}" data-path="{{ item.url ~ '?token=' ~ path }}" data-title="{{ item.name|escape('js') }}" data-id="{{ item.id }}" href="javascript:void(0)" class="js-url-chooser-media-select" data-cke="{% if cke %}true{% else %}false{% endif %}">
<a data-thumb-path="{{ thumbnailurl is not empty ? asset(thumbnailurl, 'media') }}" data-path="{{ asset(item.url ~ '?token=' ~ path , 'media') }}" data-title="{{ item.name|escape('js') }}" data-id="{{ item.id }}" href="javascript:void(0)" class="js-url-chooser-media-select" data-cke="{% if cke %}true{% else %}false{% endif %}">
Select
</a>

Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@
{% if imageurl|lower|split('.')|last == 'svg' or 'image/svg' in media.contentType %}
{% set imageurlretina = imageurl %}
{% else %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina')) %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail')) %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina'), 'media') %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail'), 'media') %}
{% endif %}
{% endif %}

{% set path = "[%s]" | format("M" ~ media.id) %}

<div class="col-sm-6 col-md-4 col-lg-3">
<a href="javascript:void(0)" class="js-url-chooser-media-select thumbnail media-thumbnail" data-thumb-path="{{ imageurl }}" data-path="{{ media.url ~ '?token=' ~ path }}" data-title="{{ media.name|escape('js') }}" data-id="{{ media.id }}" data-cke="{% if cKEditorFuncNum %}true{% else %}false{% endif %}">
<a href="javascript:void(0)" class="js-url-chooser-media-select thumbnail media-thumbnail" data-thumb-path="{{ imageurl }}" data-path="{{ asset(media.url ~ '?token=' ~ path, 'media') }}" data-title="{{ media.name|escape('js') }}" data-id="{{ media.id }}" data-cke="{% if cKEditorFuncNum %}true{% else %}false{% endif %}">
<figure>
{% if imageurl %}
<img src="{{ imageurl }}" srcset="{{ imageurl }} 1x, {{ imageurlretina is defined ? ', ' ~ imageurlretina ~ " 2x" }}" alt="{{ media.name }}" class="media-thumbnail__img">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@
{% if imageurl|lower|split('.')|last == 'svg' or 'image/svg' in media.contentType %}
{% set imageurlretina = imageurl %}
{% else %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina')) %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail')) %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina'), 'media') %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail'), 'media') %}
{% endif %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
{% if imageurl|lower|split('.')|last == 'svg' or 'image/svg' in media.contentType %}
{% set imageurlretina = imageurl %}
{% else %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina')) %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail')) %}
{% set imageurlretina = asset(imageurl | imagine_filter('media_list_thumbnail_retina'), 'media') %}
{% set imageurl = asset(imageurl | imagine_filter('media_list_thumbnail'), 'media') %}
{% endif %}
{% endif %}
{% if imageurl %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends '@KunstmaanMedia/Media/show.html.twig' %}

{% block extraactions %}
<a href="{{ asset(media.url) }}" target="_blank" class="btn btn-primary btn--raise-on-hover">
<a href="{{ asset(media.url, 'media') }}" target="_blank" class="btn btn-primary btn--raise-on-hover">
{{ 'media.media.download.action'|trans }}
</a>
{% endblock %}
Expand All @@ -14,9 +14,9 @@
{{ 'media.media.mediainfo.downloadlink'|trans }}:
</dt>
<dd>
{% set mediaUrl = media.url %}
<a href="{{ absolute_url(asset(mediaUrl)) }}" target="_blank">
{{ absolute_url(asset(mediaUrl)) }}
{% set mediaUrl = absolute_url(asset(media.url, 'media')) %}
<a href="{{ mediaUrl }}" target="_blank">
{{ mediaUrl }}
</a>
</dd>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
{% block extraactions %}

{% if handler.aviaryApiKey and not (handler.aviaryApiKey starts with 'Register') %}
<button type="button" class="btn btn-primary btn--raise-on-hover" onclick="return launchEditor('editimage', '{{ absolute_url(asset(media.url)) }}');" >
<button type="button" class="btn btn-primary btn--raise-on-hover" onclick="return launchEditor('editimage', '{{ absolute_url(asset(media.url, 'media')) }}');" >
{{ 'media.media.edit.action' | trans }}
</button>

{% include '@KunstmaanMedia/Media/Image/aviary.html.twig' %}
{% endif %}

<a href="{{ asset(media.url) }}" target="_blank" class="btn btn-default btn--raise-on-hover">
<a href="{{ asset(media.url, 'media') }}" target="_blank" class="btn btn-default btn--raise-on-hover">
{{ 'media.media.download.action'|trans }}
</a>
{% endblock %}
Expand All @@ -21,7 +21,7 @@
{% if imageurl|lower|split('.')|last == 'svg' or 'image/svg' in media.contentType %}
{% set imageurl = imageurl %}
{% else %}
{% set imageurl = asset(imageurl | imagine_filter('media_detail_thumbnail')) %}
{% set imageurl = asset(imageurl | imagine_filter('media_detail_thumbnail'), 'media') %}
{% endif %}
{% endif %}
<img id="editimage" class="img-thumbnail" src="{{ imageurl }}" alt="{{ media.name }}">
Expand Down
1 change: 1 addition & 0 deletions src/Kunstmaan/MediaBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"symfony/mime": "^4.4",
"imagine/imagine": "^1.1",
"knplabs/knp-gaufrette-bundle": "~0.1",
"kunstmaan/admin-bundle": "^5.9|^6.0",
"kunstmaan/adminlist-bundle": "^5.9|^6.0",
"pagerfanta/twig": "^2.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{% if name is empty %}
{% set name = "Download" %}
{% endif %}
<p class="download-pp"><a href="{{ absolute_url(asset(resource.media.url)) }}" target="_blank" class="download">{{ name }}</a> <span>| {{ resource.media.contentTypeShort }} {{ resource.media.getFileSize() }}</span></p>
<p class="download-pp"><a href="{{ absolute_url(asset(resource.media.url, 'media')) }}" target="_blank" class="download">{{ name }}</a> <span>| {{ resource.media.contentTypeShort }} {{ resource.media.getFileSize() }}</span></p>
{% endif %}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="image-pp">
{% set imgUrl = '' %}
{% if app.request %}
{% set imgUrl = absolute_url(asset(resource.media.url)) %}
{% set imgUrl = absolute_url(asset(resource.media.url, 'media')) %}
{% endif %}
{% if resource.link is defined and resource.link != "" %}
<a href="{{ resource.link | replace_url}}" {% if resource.openinnewwindow %}target="_blank"{% endif %}><img src="{{ imgUrl }}" alt="{{ resource.alttext }}" /></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% for pagePartType in pagepartadmin.possiblePagePartTypes %}
<div class="pp-search__item js-pp-search-item col-sm-6 col-lg-4" data-pp-name="{{ pagePartType.name|trans }}">
{% if pagePartType.preview is defined and pagePartType.preview is not empty %}
{% set background = asset(pagePartType.preview) %}
{% set background = asset(pagePartType.preview, 'media') %}
{% else %}
{% set background = asset('bundles/kunstmaanadmin/default-theme/img/kunstmaan/ppchooser-placeholder.svg') %}
{% endif %}
Expand Down
Loading