(I've tried this with multiple releases, including 1.6, and the issue remains).
I have a custom CTools content type (plugin), which is to be output in a panel layout being used for the homepage. The plugin configuration is using several custom form elements, all of which work fine aside from one, which is of '#type' => 'media'.
The media dialog opens over the CTools dialog (great), and I'm able to save/upload an image after going through the media upload wizard with the file being saved in the database. The Media dialog then closes, then the image's thumbnail is visible within the field as it should. However, within a second or so, a throbber appears next to the field, followed by the field disappearing all together and being replaced with: ''.
I'm assuming that this is indeed an issue with the CTools dialog, rather than the Media module. For reference, the form field's definition is below:
$form['welcome_block_hero_image'] = array(
'#type' => 'media',
'#tree' => TRUE,
'#title' => t('Hero Image'),
'#description' => t('Allowed formats: PNG, JPG, JPEG, GIF.'),
'#media_options' => array(
'global' => array(
'file_extensions' => 'png jpg jpeg gif',
'max_filesize' => '10 MB',
'types' => array('image'),
),
),
'#required' => TRUE,
);
Any info here would be great.
Thanks in advance,
Adam
Comments
Comment #1
adam_thomason CreditAttribution: adam_thomason commentedNot sure if this has been seen by anybody? It'd be great if somebody could give a bit of insight here.
Comment #2
gaborpeter CreditAttribution: gaborpeter commentedHello Adam.
I believe we had the same issue, and adding
form_load_include($form_state, 'inc', 'your_modulename', 'your_plugin/ctools_file/path');
to the beginning of the form function ill solve this issue.
Comment #3
vood002 CreditAttribution: vood002 commentedThank you gaborpeter! I don't know why this works, but your solution worked for me. Edit: grammar
Comment #4
DamienMcKennaThat sounds like a pretty important thing to document.
Comment #5
darrenwh CreditAttribution: darrenwh as a volunteer and commented@adam_thomason did you use hook_ctools_plugin_directory() ? I think this may be related
Comment #6
Albert Volkman CreditAttribution: Albert Volkman commentedI attempted to use the suggested fix in #2, but to no avail. Crosslinking this issue- #2385685: Media Input is removed when using FAPI in a panel
Comment #7
zlatev CreditAttribution: zlatev commentedHi,
Has anyone managed to debug this issue? Proposed solution in #2 is not working out for me either.
Comment #8
MustangGB CreditAttribution: MustangGB commented