Adding Alt Tag & Title Tag Support for Media 1.x on Existing Drupal 7 Sites

This article explains how I went about adding alt/title support for images using the Media module on an existing Drupal 7 site (with media-7.x-1.x already installed).  It assumed you have SSH access to your site. Please also note, I have only used this method using an image field with the media file selector widget, I'm yet to test it with a file field.

If you're creating a new site, look at using media-7.x-2.x as it has this support by default (At time of writing 2.x is still unstable.), otherwise, read on.

Apply patch to media module

  1. Navigate / cd into the */modules/media file.
  2. WGET this patch into the media module's folder.
  3. Apply the patch using patch -p1 < path/file.patch More more information on applying patches, read the Drupal.org documentation here.

Add fields to the 'Image' filetype

  1. Go to admin/config/media/file-types/manage/image/fields and add the following fields.
  2. Add a 'Alt Text' text field with default settings and use the following machine name: field_file_image_alt_text
    Note: Remember that field_ is prepended to the editable part of a machine name automatically.
  3. Add a 'Title Text' text field with default settings and use the following machine name:  field_file_image_title_text

Enable Alt / Title text support on your field

  1. Browse to the 'Manage Fields' screen of your content type, and hit edit on the image field you wan't to enable alt/title support for.
  2. Tick off Enable Alt / Title text boxes and save the settings.

All done

You should now be able to add and edit alt text & title text tags for individual media when adding or editing a node.

Thanks

Thanks a lot, to all the great people who helped get alt / title support into the media module.  See the below issues to give thanks yourself.

http://drupal.org/node/1307054
http://drupal.org/node/1343022

Add new comment

Wysiwyg public

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.