You are here

function video_embed_field_field_instance_settings_form in Video Embed Field 7.2

Same name and namespace in other branches
  1. 7 video_embed_field.module \video_embed_field_field_instance_settings_form()

Implements hook_field_instance_settings_form().

File

./video_embed_field.field.inc, line 90
Implement a video field.

Code

function video_embed_field_field_instance_settings_form($field, $instance) {
  $settings = $instance['settings'];
  $providers = video_embed_get_handlers();
  $allowed_providers = array();
  foreach ($providers as $provider_id => $definition) {
    $allowed_providers[$provider_id] = $definition['title'];
  }
  $form['allowed_providers'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select the allowed video providers'),
    '#options' => $allowed_providers,
    '#default_value' => isset($settings['allowed_providers']) ? $settings['allowed_providers'] : array(),
    '#weight' => 10,
  );
  $form['description_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable <em>Description</em> field'),
    '#default_value' => isset($settings['description_field']) ? $settings['description_field'] : '',
    '#description' => t('The description field allows users to enter a description about the video.'),
    '#weight' => 11,
  );
  $form['description_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Max description length'),
    '#default_value' => isset($settings['description_length']) ? $settings['description_length'] : 128,
    '#weight' => 12,
    '#size' => 5,
    '#maxlength' => 5,
    '#states' => array(
      'visible' => array(
        ':input[id="edit-instance-settings-description-field"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  return $form;
}