Using Atrium I needed to remove the iTweak upload attachment description "Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds."

In order to remove this I attempted to unset the forms atttachments['#description'] using Drupal's hook_form_alter() function however, additional text stating the max file size and what are valid file extensions is later appended with no override or configuration option to remove this.

My solution was to create a patch file which adds the option 'itweak_show_attachments_description' allowing the description to be included or excluded passing TRUE or FALSE, respectively.

The patch replaces line 265 of the .module file with the following:

if (FALSE === strpos($form['attachments']['#description'], $add_descr) && variable_get('itweak_show_attachments_description', 1))

The variable can now be changed using the following commands:

drush vset itweak_show_attachments_description 0
drush vset itweak_show_attachments_description 1

See patch file attached.

CommentFileSizeAuthor
itweak_fix_forced_description.patch1.19 KBmattlayt
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iva2k’s picture

The idea is good, fix is simple, but I won't accept this patch as provided because it uses 'itweak' as its variable namespace. There are 3 iTweak projects out there (iTweak Upload, iTweak Links, iTweak Login). Also, iTweak Upload has a hierarchy of variables that allows it to have site default, and node type specific settings. So I changed the code to the following:

  if (FALSE === strpos($form['attachments']['#description'], $add_descr)
    && _itweak_upload_get_setting('show_attachments_description', '', $node_type, 1))

This creates the following hierarchy of variables:

  • itweak_upload_show_attachments_description_default
  • itweak_upload_show_attachments_description_<node type>

Setting "itweak_upload_show_attachments_description_default" will affect all node types on the site, and "itweak_upload_show_attachments_description_<node type>" is per-node type setting.

I'm making this code part of 6.x-2.x-dev (commit will follow soon).

iva2k’s picture

Version: 6.x-2.5 » 6.x-2.x-dev
Status: Active » Fixed

I committed to 6.x-2.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.