Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Possibility to overwrite formextra twig blocks, realpath for base_pat…

…h to replace correctly in image type, use of asset in image type
  • Loading branch information...
commit 09243c2a91317342b2f737809449bf6048e1b0d1 1 parent 72c06df
David Frerich cdfre authored
4 DependencyInjection/Compiler/TwigFormPass.php
@@ -19,8 +19,8 @@ public function process(ContainerBuilder $container)
19 19 }
20 20
21 21 $container->setParameter('twig.form.resources', array_merge(
22   - $container->getParameter('twig.form.resources'),
23   - array('SimpleThingsFormExtraBundle:Form:div_layout.html.twig')
  22 + array('SimpleThingsFormExtraBundle:Form:div_layout.html.twig'),
  23 + $container->getParameter('twig.form.resources')
24 24 ));
25 25 }
26 26 }
2  Form/Type/ImageType.php
@@ -56,7 +56,7 @@ public function buildView(FormView $view, FormInterface $form)
56 56
57 57 if ($data && (strpos($data->getPath(), $form->getAttribute('base_path')) === 0)) {
58 58 /* @var $data SplFileInfo */
59   - $uri = str_replace($form->getAttribute('base_path'), $form->getAttribute('base_uri'), $data->getRealPath());
  59 + $uri = str_replace(realpath($form->getAttribute('base_path')), $form->getAttribute('base_uri'), $data->getRealPath());
60 60 if ('/' !== DIRECTORY_SEPARATOR) {
61 61 $uri = str_replace(DIRECTORY_SEPARATOR, '/', $uri);
62 62 }
2  Resources/views/Form/div_layout.html.twig
@@ -17,7 +17,7 @@
17 17 {% spaceless %}
18 18 <div class="form_image">
19 19 {% if image_uri is defined %}
20   - <img src="{{ image_uri }}" alt="{{ image_alt }}"{% if image_height > 0 %} height="{{ image_height }}"{% endif %}{% if image_width > 0 %} width="{{ image_width }}"{% endif %}/>
  20 + <img src="{{ asset(image_uri) }}" alt="{{ image_alt }}"{% if image_height > 0 %} height="{{ image_height }}"{% endif %}{% if image_width > 0 %} width="{{ image_width }}"{% endif %}/>
21 21 {% else %}
22 22 {% trans %}No image uploaded.{% endtrans %}
23 23 {% endif %}

0 comments on commit 09243c2

Please sign in to comment.
Something went wrong with that request. Please try again.