You are here

function emvideo_emfield_widget_extra in Embedded Media Field 6.2

Implements hook_emfield_widget_extra().

File

contrib/emvideo/emvideo.module, line 795
Embedded Video module is a handler for 3rd party video files.

Code

function emvideo_emfield_widget_extra($form, $form_state, $field, $items, $delta = 0, $module) {
  $element = array();
  if ($module == 'emvideo') {

    // Add a title field, but only if the field is allowed.
    // If the title is already being used allow it for editing even if it is disabled.
    if ($field['widget']['meta_fields']['title'] || !empty($items[$delta]['title'])) {
      $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.'),
      );
    }

    // Add a description field, but only if the field is allowed.
    // If the description is already being used allow it for editing even if it is disabled.
    if ($field['widget']['meta_fields']['description'] || !empty($items[$delta]['description'])) {
      $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;
}