Download & Extend

Views integration for Title & Description

Project:Embedded Media Field
Version:6.x-2.x-dev
Component:Embedded Video Field
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Issue tags:accessibility

Issue Summary

Hello,

firstly thanks for this wonderful module. Works like a charm. There is just one thing i couldn't figure out. Is there a possibility to add a custom title to every embedded video?

About any hint about achieving this i would be very glad!

Comments

#1

Status:active» postponed (maintainer needs more info)

Can you please explain a bit more about what you'd like it to do? This might be better handled on the theme layer, since I doubt we'll be adding the functionality to the module itself.

#2

Is there a possibility to add a custom title to every embedded video? I have one node with many videos and want add custom title for each video

#3

Version:5.x-1.2» 6.x-1.x-dev

Hi,

Let me second this feature request. It would be convenient to be able to attach a title to each embedded media item in the same way as filefield items have a title attribute. Themers could then display the title below the media in node content or Lightbox popups, for example. It seems reasonable for the emfield module to allow this kind of simple textual metadata to be associated with the embedded media.

I can probably try and propose a patch for this particular functionality if maintainers aren't opposed to the idea itself.

Cheers,
mt-i

#4

Priority:normal» minor

Maybe make hook_PROVIDER_data() grab the video title from the provider, and then add a "Display title" field in the display settings alongside the Autoplay feature?

#5

Status:postponed (maintainer needs more info)» active

I agree with mt-i in #3 that there should be a title (or description) field associated with each embedded media field item, just like with filefield and imagefield. Is there a good reason why this can't be implemented? I can't see a better solution to the problem of displaying titles for multiple emfield thumbnails associated with a single node.

#6

Priority:minor» normal

#7

+1 for this feature, do this like in file attach. And glad to see not only one text field, but the title (on top of video) and short description (on bottom).

#8

I have created the module that adds "title" and "description" fields to all embeded media items and shows the "title" upper and "description" lower the video thumbnail.

It use separated table for store this fields (not cck api, because I didn't understand it api), but works for my sites perfectly.

At now it works only for video thumbnails mode, but you can modify other themes for show the $item['data']['title'] and $item['data']['description'] fields in any place you want.

AttachmentSize
emfields.tar_.gz 1.31 KB

#9

Hi Murz,

Thanks a bunch for the module you posted above! Unfortunately, it won't work in Drupal 6.15 and Emfield 6.x-2.x-dev.

phptemplate_emvideo_video_thumbnail returns an error and brings up the WSOD - I've isolated it to the line
$output .= theme_emvideo_video_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array());

If you remove that line, then it works properly.

Second, the fields disappear upon preview. I think it has to do something with the '#default_value' field in emfields_emfield_widget_extra when the form is called, but am not sure how to have the value be temporarily saved over when previewed. Any ideas?

Thanks!

#10

I am using Drupal 6.15 & EmField 6.x-2.x-dev (2009-Dec-19) and Murz's module in #8 works but the additional fields do not appear to be available when creating a view so it's of no use.

#11

I like Rob's suggestion of taking the title from the video. Keeps the interface simpler. If someone wants to change the video title, they should reupload/update it on the service that they are using.

#12

I need this also. Was a little shocked to find it wasn't an option honestly.

Taking it from the video is way too limited. There are many possible cases where the video title is useless, or the user simply wants his own title.

#13

Would like to add my voice to this feature request, as being a) Extremely basic and b) Extremely necessary. I've found myself in a position where very late in the day on a client website I discovered that this isn't possible and am faced with either hacking the emfield module or telling the client he can't have captions on his video thumbnails. The first is undesirable and the second is very difficult to explain.

#14

Subscribing

#15

+1 Subscribing

#16

Subscribing.

#17

Looking for this funcionality as well!!! But in fact i need to add titles to my images. I can show a bunch of images but theres no title or explanation on them. Makes it dificult for reader to figure out what are the images about. Would the great if i could set up a custom title to every image

#18

subscribe

#19

subscribe

#20

subscribe!

#21

Subscribing.

#22

What if you are just grabbing a video from a source like youtube and you wanted full control over the title and description. Seems like the ability to extend emfield with additional custom data is a nice addition to this already great module. As mentioned earlier, imagefield_extended is a great example of what we can do.

#23

Subscribing

#24

+1 for description!

In order to be inline with the Web Content Accessibility Guidelines 1.0 (WCAG 1.0) there should also be an option to use the description as the alt tag inside the object.

#25

subscribe!!

#26

Subscribe - it'd be really useful if this was supported.

I gave the module from Murz (#8 above) a shot, and it does work for me (I'd just rather use something supported/maintained). I'm using Drupal 6.15 and Emfield 6.x-1.19.

I had to make two changes, though, possibly because I'm using the lightbox2 module to display videos in a lightbox. The link it originally made on the video thumbnail wasn't working (it just went to the current page), so I changed the last function in a few spots (lines 43 and 47). The fix was to just change $no_link = FALSE to $link. The whole thing (title, thumb, desc) appears as a link, but that's fine by me as long as it properly triggers the lightbox.

Hope that helps somebody else!

#27

Category:feature request» bug report

This seems like more of a bug, and less of a feature request to me. If information about multimedia (images / videos) is being stored without at the very least a textual title / description then it fails to pass WCAG 2.0 success criteria 1.1.1 (priority A) http://www.w3.org/TR/UNDERSTANDING-WCAG20/text-equiv-all.html . In Drupal core this would be considered a critical bug.

#28

Hello, Murz! I've used your module (#8) with drupal 6.16 and Embeded Video Field 6.x-1.20. I have 2 languages on the site. So, when I try to save a translation of a node with the same video but translated title and description — they disappear in the original node. Have you any ideas how to fix that?

UPD. I found out the problem appears when synchronize fields is on.

#29

This would definitely be helpful. Currently, on hover, multiple videos display the node title in the tool tip, which can lead to some confusion. I was somewhat expecting this feature to function similarly to Imagefield when multiple fields are used and was a little surprised that it didn't. Additionally, having the video data available to Views (again similar to Imagefield) would also be great.

Thanks for your efforts to date, this is a great module and it just keeps getting better.

#30

an issue is that various providers offer different types of metadata, such as title, description, tags, author, number of views, comments, etc. version 3 of the module is a rework that should have a better system in place for metadata. for now, patches are welcome, as at least title should be consistent across most providers.

#31

I added this to emvideo.module using the latest dev version. This tries to take the solution in #8 and incorporate it into the existing module.

The first function adds the columns to the existing database for the field. The second function process the field on edit. The third add the fields to the edit form. The second function has 2 "fixes" because I was getting database error for unset variables. I could not trace the true root cause, so I put these in place. I also applied the fix in http://drupal.org/node/600386.

I also attached the modified theme.inc file changes to display the new title/description. I have tested this on my live site w/o and issues. I know there is room for improvement, but I though since it worked, other might like it too.

Please try and provide any feedback.

/**
*  Implements hook_emfield_field_columns_extra().
*  This is called to add 2 extra columns to the database to store the title and description.
*/

function emvideo_emfield_field_columns_extra(){
  $columns = array(
    'title' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE),
    'description' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE),
    );
  return $columns;
}

/**
*  Implements hook_emfield_field_extra().
*  This is called on field operations to allow us to act on emvideos.
*/
function emvideo_emfield_field_extra($op, &$node, $field, &$items, $teaser, $page, $module) {
  switch ($op) {
    case 'validate':
      if (!isset($field['submit'])) {
        foreach ($items as $delta => $item) {
          if (isset($item['embed']) && !empty($item['embed'])) {
            if (empty($item['emvideo']['title'])) {
              $err_msg[] = 'Video Title';
            }
            if (empty($item['emvideo']['description'])) {
              $err_msg[] = 'Video Description';
            }
            if (isset($err_msg)) {
              $plural = (count($err_msg)==1)?' is':'s are';
              form_set_error('emvideo', implode(' and ', $err_msg).' field'.$plural.' required.');
            }
          }
        }
      }
      break;
    case 'insert':
    case 'update':
      // Called before content.module defaults.
      foreach ($items as $delta => $item) {
        if (isset($item['emvideo']['delete']) && $item['emvideo']['delete']) {
          $items[$delta]['embed'] = NULL;
          $items[$delta]['value'] = NULL;
          $items[$delta]['provider'] = NULL;
          $items[$delta]['data'] = NULL;
          $items[$delta]['embed'] = NULL;
          $items[$delta]['version'] = 0;
          $items[$delta]['duration'] = 0;
          $items[$delta]['title'] = NULL;
          $items[$delta]['description'] = NULL;
        } else {
          // Add alt text and alt title
          if (!empty($items[$delta]['emvideo']['title'])) {
            $items[$delta]['title'] = $items[$delta]['emvideo']['title'];
          }
          if (!empty($items[$delta]['emvideo']['description'])) {
            $items[$delta]['description'] = $items[$delta]['emvideo']['description'];
          }
        }
      }
      // We're saving in the data property so delete emvideo
      if (isset($items[$delta]['emvideo'])) {
        unset($items[$delta]['emvideo']);
      }
      // FIX FOR STATUS FIELD
      if (!isset($items[$delta]['status'])) {
        $items[$delta]['status'] = EMFIELD_STATUS_AVAILABLE;
      }
      // FIX FOR DATA NOT EMPTY
      if (empty($items[$delta]['data'])) {
         unset($items[$delta]['data']);
      }
      // Compact deltas.
      $items = array_values($items);
      //dpm($items);
      break;
  }
}

/**
*  Implements hook_emfield_widget_extra().
*/
function emvideo_emfield_widget_extra($form, $form_state, $field, $items, $delta = 0, $module) {
  $element = array();
  if ($module == 'emvideo') {
    $element['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Video Title'),
      '#default_value' => isset($items[$delta]['title']) ? $items[$delta]['title'] : '',
      '#size' => 60,
      '#maxlength' => 35,
      '#description' => t('The title for the video.'),
      );
    $element['description'] = array(
      '#type' => 'textfield',
      '#title' => t('Video Description'),
      '#default_value' => isset($items[$delta]['description']) ? $items[$delta]['description'] : '',
      '#size' => 60,
      '#maxlength' => 100,
      '#description' => t('The description for the video.  Provide text for visitors who can not see the images in page.'),
      );
    if (!empty($items[$delta]['embed'])) {
      $element['delete'] = array(
        '#type' => 'checkbox',
        '#title' => t('Delete the Video'),
        '#description' => t("Checking this field will delete the video."),
        '#default_value' => 0,
        );
    }
  }
  return $element;
}
AttachmentSize
emvideo-theme.patch 4.36 KB

#32

This is exactly what I was looking for also and I see that it has it now fortunately for me. My current problem is, how do I display this custom title through Views?

#33

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:active» needs review

The attached patch expands on what seworthi posted in #31.
All I did was add a setting so you could choose if you needed the title and description.
This can easily be expanded to work the same way imagefield does its title and alt text.
I don’t need views integration for the moment, so I have not looked at that.

Please note I am using 6.x-2.x-dev.

AttachmentSize
emvideo_meta_fields.patch 10.03 KB

#34

Thanks, I think that's on the right track. I personally need the views integration also and would love it if this worked like imagefield.

#35

It would be wonderful to see this integrated with views, and apply to all embedded media types (not just videos), and as #27 mentions, this is an accessibility issue, not just a desired bit of functionality. Having it integrate with views is also a very important feature to integrate.

I'm a complete newb at most module-related code, but I might just have a look at this...but hopefully someone more competent might give it a go?

#36

Priority:normal» critical

We definitely understand the importance of this issue and appreciate the need to make Emfield accessible to all, and as such I'm changed the priority to 'critical'. Aaron is going to take a look at this over the next few days, and I can say that this will definitely be a feature of the first 2.x release. Once he looks at what's here (it looks fine to me, but the potential implications are a bit above my pay grade), I can take a stab at the views integration piece.

#37

I was hunting for this feature when I landed on this thread. Very much needed.

#38

Hi, would love to see this feature too :)

#39

Subscribing. Looking forward to having titles and descriptions for the embedded elements.

#40

Subscribing.

Any news on when this will be implemented since it has been critical for 2 months now? Even on a simple, no views integration, basis? Seems like something that can be easily implemented especially since the "Embedded Media Thumbnail" module gives this functionality for the images.

Would be a really nice feature to have.

Thanks

#41

Assigned to:Anonymous» kleinmp

I'm assigning this to Matt Klien here at Zivtech- he'll take a look and commit it today if it looks good (or commit an alternative).

#42

Category:bug report» feature request
Status:needs review» active

I tested out the patch and it successfully added the title and alt text to my embedded video cck field. I could also delete the video with the delete checkbox.

I committed it to the 6.x-2.x-dev branch, but I'm leaving this open for now, since the views integration was not addressed in the patch.

#43

Title:Title field for embedded video» Views integration for Title & Description
Status:active» needs work

Changing title and status. Also, removing the assignment from kleinmp

#44

Priority:critical» normal
Assigned to:kleinmp» Anonymous

#45

subscribe

#46

subscribe

#47

I found the same problem and I made a workaround solution.
So, I wanted the "preview" display to include the title and description of the video.

For that, I changed in the "emvideo.theme.inc" file, "theme_emvideo_video_preview" function, the line:

$output = '<div class="emvideo emvideo-preview emvideo-'. check_plain($item['provider']) .'">'. $output .'</div>';

for this:

$output = '<div class="emvideo">'. '<div class="emvideo-title">' . $item['title'] . '</div>' . '<div class="emvideo-preview emvideo-'. check_plain($item['provider']) .'">'. $output . '</div>' . '<div class="emvideo-description">' . $item['description'] . '</div>' . '</div>';

I wrap video, title and description in the class "emvideo" and create the classes "emvideo-title" and "emvideo-description" for the title and description texts.
Hope this is useful for someone!

#48

Hmm, was this _really_ a good idea? I'm questioning whether this patch was a good addition to emfield. I think it works for one use case, but not necessarily others and also in my opinion causes some significant UX issues.

Consider
- I post an item to archive.org (or youtube). It asks for a title and description at that time and I fill it in.
- Now I come to my drupal site and past my emfield link in to my emfield
- Hmm, I have an option to put in a thumbnail on top of the one my provider gives. OK, maybe that's all right as the thumbnails generated by the provider aren't so hot.
- Hmm. When I put the thumbnail I now have an option to provide a title and description for that! Hey doesn't my item (on archive or youtube) already have that? Why isn't emfield getting it?
- Hmm. Wait now I also have an option to display a title and description along with the emfield link. Hey, why isn't it pulling in the title and description from my archive or youtube item! Shouldn't it at least provide those as a default for me to edit?

So where is the option for me to tick off "get this automatically from the provider"?

And which one should be displayed?

Oh, and what if the provider already pulls out the title and description and displays it with the item already? Doesn't that provider programmer need to accommodate this now too?

Oh, and by the way we've now created database fields for things that not everyone needs or wants.

There are other valid Drupal ways to provide users with the ability to override the title and description. For example you could wrap a content type around an item and allow for any additional meta information you want there without having to touch emfield. You'd then use a nodereference to attach that to another item. This is a valid strategy used for example by the Openpublish distro. These are more difficult, but would have avoided hacking emfield for something I don't think all emfield users want.

#49

Status:needs work» needs review

#50

Status:needs review» needs work

Sorry wrong status. See my last comment above. Not sure if "Open" or "Needs Work" is the right status here.

Or perhaps a new issue to "remove this patch from emfield"?

#51

I don't really understand your argument. For accessibility purposes, the description has to be there, so the patch is good. Since the thumbnail image could be customized, it could have a different alt description than the video. Yes, it'd be great if that could be pulled from the provider for consistency, but it's a simple copy/paste. That is, if you want them to stay the same. Some users could want to use different language for archive purposes to describe the video than what they use to describe the video to their visitors.

#52

...the description has to be there, so the patch is good.

I think that is faulty logic. Of course a well designed site should offer alt text and/or description as per accessibility guidelines. That doesn't necessarily mean it is emfield's job to do that. I believe I mentioned that there are other perfectly valid ways of doing that without this modification of emfield.

#53

I'm wondering why the patch has title and description fields of db-length 255, and yet limits them to 30 and 100 characters respectively. Why have the limits on the input? They are, in my opinion, too small. I have a client that wants to enter more text describing the embedded videos, and I'll have to patch this to make it work for my client. Can we not get them to be max of 255 on the input?

And by the way, I think this capability is needed, as I imagine a number of users will want to embed videos that they may not have uploaded, and thus want to 'override' the provider-provided titles and descriptions. So, perhaps the correct UX is to have a checkbox to use the provider-provided bits, and textfields for site-provided overrides.

Shawn

#54

Capability is needed yes. I just think this was a misguided way to provide it.

#55

@winston:

I agree with some of your thoughts and disagree with others.

I agree that there should be an option to pull this information in from the provider, however, since all providers differ in what or if they provide it, this functionality is to be placed in the media_* provider modules. The storage and of the data and the option to put in custom data is completely generic and needs to be in emfield to optionally be used by all.

I do not agree with the other ways to do it argument. While you proposed scenario will work for a dedicated media content type, it would not work for content types that have a media field as just one of many other fields related around something else (ex. a meeting notes content type that has a video or audio of the meeting as 1 of 20 fields. The proposed solution would also completely fail when using a multiple value emfield as then the single node now has many emfields that can be ordered by the user.

On top of all that the best thing is this is optional which makes it very convenient to use for those that need it and that do not need it.

As for whether this should be in a separate DB table or stored elsewhere, that is up for debate but that is only a change to the patch.

There are features missing as mentioned above, like views integration and provider integration but this patch is a good base start to make those additions or changes. As such, this thread should probably be closed and open separate issues to each additional feature or change discussion.

#56

Any update on this issue ?

Imagefield comes with data description and it would be beneficial to have data field for 3rd party video.

Thx Much if someone provides an update on this issue.

#57

For the ones who need a Views description field.
ONLY in case you are not using the status field, put in your theme (template.php) this function:

myThemeName_emfield_handler_field_status($item, $field, $node, $values, $format) {
  return check_plain($item['description']);
}

Flush caches!
Then, in Views, the field "status" it will represent the "description" one.

#58

works great thank you:)

#59

hi.

i have made some code changes to expose the Description and Title field to the Views interface. i just need to figure out how i go about generating a patch and source code control stuff. I will try to have a patch posted here by tomorrow.

#60

hello, as promised a patch file which exposes Title and Description to Views. I had to quickly learn Git and I am not totally sure I have created the patch correctly. I struggled with the two new files I had as they weren't coming up in the diff at first.

Anyway, this is a patch for the 6.x-2.x-dev branch. If anyone dares give it a go I'll be happy to make any tweaks or whatever.

AttachmentSize
emfield-289432-59.patch 12.83 KB

#61

is this module still maintained? can anyone help me get the above patch delivered?

#62

Status:needs work» needs review

@Andy : usually the maintainer focuses on the status.

#63

And for the next commit, it would be nice to increase the #maxlength attribute of the Video Title form field. 35 is a bit too short... I don't submit any patch for such a little change, it's in emvideo.module line 781.

nobody click here