Closed (fixed)
Project:
Plupload integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2012 at 06:56 UTC
Updated:
30 Nov 2012 at 08:30 UTC
Hi,
I installed the plugin and it works out of the box. But if I want to overwrite the #plupload_settings the javascript settings are not set, the default values are used.
How I use plupload in my template:
$form['my_element'] = array(
'#type' => 'plupload',
'#title' => t('Upload files'),
'#description' => t('This multi-upload widget uses Plupload library.'),
'#upload_validators' => array(
'file_validate_extensions' => array('jpg')
),
'#plupload_settings' => array(
'runtimes' => 'html5,flash,html4',
'chunk_size' => '2mb',
'url' => url(path_to_theme().'/cal_editor_upload.php', array('query' => array('plupload_token' => drupal_get_token('plupload-handle-uploads')))),
),
);
print render($form['my_element']);The pluploader is displayed correctly but the javascript is initiated with the default values. The problem seams to be #id because it's not set.
plupload.js problem
var elementSettings = (id && settings.plupload[id]) ? settings.plupload[id] : {};
Debugging of defaultSettings, elementSettings and pluploadSettings see attachment.
debug img
Many thanks for your plugin!
Best regards
Comments
Comment #1
slashrsm commentedHave you tried to set #id?
Comment #2
patsch_lux commentedI tried it before, no luck. See image.
Code used:
Comment #3
slashrsm commentedI tested this in a custom form and it works without problems.
Insepcting your code again I noticed that you use render() to display this. This is most likely the problem since this way #process never gets executed. You should try using drupal_get_form(), which is standard way of doing this.
Comment #4
patsch_lux commentedThank you!
It works.
Comment #5
slashrsm commentedGreat!
Comment #6.0
(not verified) commentedimg not working