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.
For simpler use inline module with TinyMCE editor i have use in my template.php this function:
/**
* Theme the attachments list.
*/
function phptemplate_upload_form_current(&$form) {
$counter = 1;
$mime_type_array['image'] = array('image/jpeg','image/pjpeg','image/gif','image/png');
$header = array(t('Delete'), t('List'), t('Description'), t('Size'), t('Inline picture'));
foreach (element_children($form) as $key) {
// is image?
if (in_array($form[$key]['filemime']['#value'],$mime_type_array['image'])) {
$typ_image = true;
}
else {
$typ_image = false;
}
$row = array();
$row[] = form_render($form[$key]['remove']);
$row[] = form_render($form[$key]['list']);
$row[] = form_render($form[$key]['description']);
$row[] = form_render($form[$key]['size']);
// if is image create link for insertting inline code
if ($typ_image) {
$row[] = "<a href=\"javascript:tinyMCE.execInstanceCommand('mce_editor_0','mceInsertContent',true,'[inline:".$counter."]')\">".t('insert code for image')."</a>";
}
else {
$row[] = '';
}
$rows[] = $row;
$counter++;
}
$output = theme('table', $header, $rows);
$output .= form_render($form);
return $output;
}
This code simple add new column to attachements table with link for insert inline image code into textarea. Maybe is there better way integrate this funcionality into inline.module?
Comments
Comment #1
sunhavran, do you use upload.module (Drupal core) or attachment.module?
Is there a reason why you do not use image.module and img_assist.module with the provided drupalimage plugin for TinyMCE?
However, in general I like the idea of simply adding image uploads/attachments into a content by click. But I'd suggest this should be a contrib module for inline.
Comment #2
havran CreditAttribution: havran commentedI use upload.module from Drupal core.
IMHO using image module seems too complicated (for 'no computer' users). Too many options etc... I need only insert simple picture into user blog (or more pictures). For this is Inline way ideal for me. (like this blog spot How to work with new Enigma pages (in slovak language).
Comment #3
sunBetter title.
A contrib module seems to be overhead for this. Instead this should be able to be activated through inline settings and maybe should get a access permission.
Will have a look on your code shortly.
Comment #4
sun