URL is not a good title for the video embed widget on node forms. Please use the $element['#title] variable to get the widget title from the content type settings form.

/**
 * Implements hook_field_widget_form().
 */
function video_embed_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  // Don't need to check the type right now because we're only defining one
  $element += array(
    '#type' => 'video_embed_field_widget'
  );

  $element['video_url'] = array(
    '#type' => 'textfield',
    '#title' => $element['#title'],
    '#description' => $element['#description'],
    '#attributes' => array('class' => array('video_embed_url')),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'video_embed_field') .'/video_embed_field.form.css'
      )
    ),
    '#default_value' => isset($items[$delta]['video_url'])?$items[$delta]['video_url']:'',
    '#required' => $element['#required']
  );

  // Add the description field if enabled.
  if (!empty($instance['settings']['description_field'])) {
    $element['description'] = array(
      '#type' => 'textfield',
      '#title' => t('Description'),
      '#default_value' => isset($items[$delta]['description']) ? $items[$delta]['description'] : '',
      '#description' => t('The description which may be used as a label.'),
    );
  }

  return $element;
}

Comments

jec006’s picture

Hi, I actually just updated this a couple days ago. Go look at the current version in dev and let me know what you think.

I completely agree with you though, we can further adjust as needed.

jec006’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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