When using the Media Browser CKEditor plugin, you get a Description field when inserting a media object. It is by default prefilled with the file name and editable.

When looking at the code it seems it is supposed to be used in the alt attribute.:

function media_media_format_form_prepare_alter(&$form, &$form_state, $file) {
  switch ($file->type) {
    case 'image':
      $form['options']['alt'] = array(
        '#type' => 'textfield',
        '#title' => t('Description'),
        '#default_value' => $file->filename,
        '#description' => t('Alternate text a user will see if the image is not available'),
      );
      break;
  }
}

This is probably risking to create conflicts with other parts dealing with the alt attribute. However, it doesn't seem to ever be used when the media object is embedded in the body field.

This also exist in the 1.x version.

Comments

szantog’s picture

tsvenson’s picture

Issue tags: +Media Sprint 2011

This field adds confusion to the user as it is never used, as far as I know, for anything. It looks like the intention is that is shall fill the alt-attribute, but it never does.

Should either be removed or made to work.

This problem exists in 1.x as well IIRC.

tsvenson’s picture

Title: What purpose does the Description field when inserting media fill? » Description field when embedding using WYSIWYG plugin isn't used to anything.

Changed title to make more sense

robeano’s picture

Title: Description field when embedding using WYSIWYG plugin isn't used to anything. » Hide Confusing Fields: Alt, Title, Description
Assigned: Unassigned » robeano

Summary

Task to complete: Update Media module to hide Description, Alt, Title fields when embedding media.

Details

The Media sprint team agrees with #1251468-2: Hide Confusing Field 'Description' When Embedding Media. The Description field is confusing. Core provides the Description field with File field. For now, Media module will hide the Description field until the Drupal Core issue resolves.

FYI, Alt and Title fields are a part of Core as well and are associated with Image field: http://drupal.org/node/1291262

I am going to use this issue to hide the Alt and Title fields as well.

It is likely that the Core issues will be resolved in D8.

For D7, we will have a work-around that uses a new module Field Formmatter Settings (once that module is ready for use).

Documentation needs to be created to help users understand how to set the Alt and Title attributes for the following in D7:

  • File fields
  • Image fields
  • Embedding media

I'll work on the patch to hide the fields.

ParisLiakos’s picture

Issue tags: +Needs documentation

Adding tag!
Documentation is a must

robeano’s picture

Title: Hide Confusing Fields: Alt, Title, Description » Hide Confusing Field 'Description' When Embedding Media
Status: Active » Needs review
Issue tags: -Needs documentation
StatusFileSize
new812 bytes

Uh, I apologize for not understanding this issue! The original title was more accurate. The following patch removes the Description field from the media browser form when embedding an image into a rich text field. As it turns out, the Description field we see there was added by the Media module not Core.

@aaronwinborn already added support for removing Alt and Title fields from Image fidle in 7.x-1.x and 7.x.-2.x branches.

To test, when embedding an image file into a rich text field using the Media Browser, you should see a form after the upload and it should NOT offer a Description field.

The correct implementation using the Field Formatter Settings and the documentation will be handled by a separate issue. See #1291518: Use Field Formatters for Embedding Options.

I'm removing the Needs Documentation tag BUT I added it to the new issue. All is not lost!

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

Tested and works.description is no longer there!

ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

This got commited.marking this as fixed,right?

muriqui’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Fixed » Needs review
StatusFileSize
new820 bytes

This should probably be backported to 1.x. I didn't see it committed on the 7.x-1.x branch, so rerolled the patch for it.

muriqui’s picture

adding backport tag so this doesn't get missed

dixon_’s picture

I don't fully understand the reasoning behind removing the description field. It's a very useful field that can be used for alt and caption texts.

I agree it's confusing if it's not being used/displayed properly. But let's make proper use of it instead? As I said, it's a very good system to use for caption texts and so on, and the description column only sits there in the database now, without being used. What a waste ;)

Can we consider adding this back and make proper use of the alt/description field again? I'd love to work on the patch if it has got a chance. Otherwise I'll just create media_alt.module :)

dixon_’s picture

And regarding this, mentioned in the OP:

This is probably risking to create conflicts with other parts dealing with the alt attribute.

I'd say there's no risk. The field and it's formatters is supposed to make use of that very alt attribute :) No other functionality is.

dixon_’s picture

People are getting confused why this field is not here. See #1307054: Accessibility - Media browser image alt and title fields.

tsvenson’s picture

I agree that being able to type in description, etc, already when adding a file is very useful and something we need to get to.

The problem though with the Description field is that it has nothing to do with the fieldable field support File Entity is providing. Thus we would have both this field and those added to the file types.

At some stage, in the not to far future, we hope to be able to expose those fields when you add a new file. The aim is also to let you reuse, edit or override existing field data for existing files too, but that is a bigger task. For example, it will require new permissions for who is allowed to edit and save over the default data for a file.

tsvenson’s picture

Issue summary: View changes

Changed to highlighted code

  • robeano committed 9150630 on 7.x-3.x
    Removed confusing and unused Description field from embed form in the...
joseph.olstad’s picture

Issue summary: View changes
Status: Needs review » Fixed
Issue tags: -

Fixed September 26, 2011 17:08

Status: Fixed » Closed (fixed)

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