Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just needed tinybrowser to upload images and not add them to any editors (not even plain text).
I did this to use a Forms API button:
function tw_node_form($form_state) {
//Upload images
if(module_exists('tinybrowser')){
drupal_add_js(drupal_get_path('module', 'tinybrowser') .'/tinybrowser/tb_standalone.js.php');
$form['uploadsubmit'] = array(
'#type' => 'submit',
'#value' => t('Upload Images'),
'#attributes' => array("onclick" => 'tinyBrowserPopUp("image","edit-preview"); return(false);'),
);
$form['preview'] = array(
'#type' => 'textarea',
'#rows' => 1,
'#disabled' => TRUE,
);
}
}
The textarea is needed to fool the tinyBrowserPopUp function, it is not used.
Maybe the developer can add another function in a future release that does not need to check for a textarea.
Thanks for a very handy module.
Quentin
Comments
Comment #1
pixture CreditAttribution: pixture commentedYes, what you did is the best for that purpose. Currently TinyBrowser opens up a new window(or tab) and display the selected file/image/media when the specified form field ID is not textarea (or input type=text with the next release). The reason I made it this way was to make it behave as same as IMCE. I never thought the use case like you did. I will think this as a possible feature to investigate.
Thanks,
Comment #2
bryancasler CreditAttribution: bryancasler commentedI like the idea of this