Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make imagine optional even when using the image form type

  • Loading branch information...
commit 045f4581c5c702beb060504ce0645c2192708256 1 parent d12d8d8
@dbu dbu authored
View
16 DependencyInjection/Configuration.php
@@ -154,7 +154,7 @@ private function addOdmSection(ArrayNodeDefinition $node)
->fixXmlConfig('document_manager')
->append($this->getOdmDocumentManagersNode())
->append($this->getOdmLocaleNode())
- ->append($this->getOdmImagineNode())
+ ->append($this->getOdmImageNode())
->end()
->end()
;
@@ -247,19 +247,17 @@ private function getOdmCacheDriverNode($name)
return $node;
}
- private function getOdmImagineNode()
+ private function getOdmImageNode()
{
$treeBuilder = new TreeBuilder();
- $node = $treeBuilder->root('imagine');
+ $node = $treeBuilder->root('image');
$node
->children()
- ->scalarNode('enabled')->defaultValue(false)->end()
- ->scalarNode('filter')->defaultValue('image_upload_thumbnail')->end()
- ->arrayNode('extra_filters')
- ->requiresAtLeastOneElement()
- ->prototype('scalar')->end()
- ->end()
+ ->scalarNode('imagine_filter')->end()
+ ->arrayNode('extra_filters')
+ ->requiresAtLeastOneElement()
+ ->prototype('scalar')->end()
->end()
->end()
;
View
20 DependencyInjection/DoctrinePHPCRExtension.php
@@ -252,17 +252,15 @@ private function odmLoad(array $config, ContainerBuilder $container)
$dm->addMethodCall('setLocaleChooserStrategy', array(new Reference('doctrine_phpcr.odm.locale_chooser')));
}
- if (isset($config['imagine']['enabled']) && $config['imagine']['enabled']) {
- $filter = $config['imagine']['filter'];
- $filters = isset($config['imagine']['extra_filters']) && is_array($config['imagine']['extra_filters'])
- ? $config['imagine']['extra_filters']
- : array();
-
- $filters[] = $filter;
- $container->setParameter('doctrine_phpcr.odm.subscriber.image_cache.filter', $filter);
- $container->setParameter('doctrine_phpcr.odm.subscriber.image_cache.all_filters', $filters);
- $this->loader->load('odm_image.xml');
- }
+ $filter = isset($config['image']['imagine_filter'])
+ ? $config['image']['imagine_filter']
+ : false;
+ $filters = isset($config['image']['extra_filters']) && is_array($config['image']['extra_filters'])
+ ? array_merge(array($filter), $config['image']['extra_filters'])
+ : array();
+ $container->setParameter('doctrine_phpcr.odm.subscriber.image_cache.filter', $filter);
+ $container->setParameter('doctrine_phpcr.odm.subscriber.image_cache.all_filters', $filters);
+ $this->loader->load('odm_image.xml');
$documentManagers = array();
foreach ($config['document_managers'] as $name => $documentManager) {
View
8 Resources/views/Form/fields.html.twig
@@ -1,6 +1,8 @@
{% block phpcr_odm_image_widget %}
{{ form_widget(form) }}
- {% if form.vars.data %}
- <img src="{{ form.vars.data | imagine_filter( imagine_filter ) }}" alt="" />
- {% endif %}
+ {% block phpcr_odm_image_widget_preview %}
+ {% if form.vars.data and imagine_filter %}
+ <img src="{{ form.vars.data | imagine_filter( imagine_filter ) }}" alt="" />
+ {% endif %}
+ {% endblock %}
{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.