genemu / GenemuFormBundle

Extra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
587 stars 263 forks source link

Can't change url in uploadify. #272

Open rsantellan opened 11 years ago

rsantellan commented 11 years ago

I'm trying to change url of uploadify so I can use my custom action.

Looking at the code the file: Genemu\Bundle\FormBundle\DependencyInjection\GenemuFormExtension.php

On the line 185:

$configs['configs'] = array_merge($configs['configs'], array( 'script' => 'genemu_upload', 'swf' => $configs['swf'], 'cancelImg' => $configs['cancel_img'], 'folder' => $configs['folder'] ));

I see that the script function is hard coded. Can it be possible to put that on a config? I'll try but I'm relatively new in Symfony 2 and I don't know if I will break anything.

Any other solution?

Regards

rsantellan commented 11 years ago

Simple fix is to do:

$default_configs = array( 'script' => 'genemu_upload', 'swf' => $configs['swf'], 'cancelImg' => $configs['cancel_img'], 'folder' => $configs['folder'] ); if(isset($configs['configs']['script'])) { unset($default_configs['script']); } $configs['configs'] = array_merge($configs['configs'], $default_configs);

And then pass in the creation of the widget:

->add('download', 'genemu_jqueryfile', array('mapped' => false, 'configs' => array('script' => 'new_upload_route' , 'debug' => true)))

I will make a branch a and make a pull a request when I reach my home. The only thing that I don't know is way this is not the default?

Cheers