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
Comment #1
szantog commentedIs this duplicated: #945354: How to create alt and title attributes and what does Description do?
Comment #2
tsvenson commentedThis 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.
Comment #3
tsvenson commentedChanged title to make more sense
Comment #4
robeano commentedSummary
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:
I'll work on the patch to hide the fields.
Comment #5
ParisLiakos commentedAdding tag!
Documentation is a must
Comment #6
robeano commentedUh, 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!
Comment #7
ParisLiakos commentedTested and works.description is no longer there!
Comment #8
ParisLiakos commentedThis got commited.marking this as fixed,right?
Comment #9
muriqui commentedThis 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.
Comment #10
muriqui commentedadding backport tag so this doesn't get missed
Comment #11
dixon_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:)Comment #12
dixon_And regarding this, mentioned in the OP:
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.
Comment #13
dixon_People are getting confused why this field is not here. See #1307054: Accessibility - Media browser image alt and title fields.
Comment #14
tsvenson commentedI 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.
Comment #14.0
tsvenson commentedChanged to highlighted code
Comment #16
joseph.olstadFixed September 26, 2011 17:08