You are here

function _brightcove_upload_form in Brightcove Video Connect 7.3

Same name and namespace in other branches
  1. 7.7 brightcove.video.inc \_brightcove_upload_form()
  2. 7.4 brightcove.module \_brightcove_upload_form()
  3. 7.5 brightcove.module \_brightcove_upload_form()
  4. 7.6 brightcove.video.inc \_brightcove_upload_form()

Base brightcove upload form.

This is not a complete form, and should not be called directly.

See also

brightcove_field_upload_form()

brightcove_media_upload_form()

1 call to _brightcove_upload_form()
brightcove_field_upload_form in brightcove_field/brightcove_field.module
Upload form. Will return a form for one video item.

File

./brightcove.module, line 869
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function _brightcove_upload_form($form, &$form_state) {
  $form = array();
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#description' => t('Video name or title.'),
    '#required' => TRUE,
    '#default_value' => !empty($form_state['values']['title']) ? $form_state['values']['title'] : '',
  );
  $form['file_upload'] = array(
    '#type' => 'file',
    '#title' => t('Video file'),
    '#size' => 40,
    '#description' => t('Allowed file types: ') . '<strong>3g2 3gp asf avi dv flv f4v m4v mov mp4 mpeg mpg mts m2ts qt wmv</strong>',
  );
  $form['short'] = array(
    '#type' => 'textarea',
    '#rows' => 3,
    '#required' => TRUE,
    '#title' => t('Short description'),
    '#description' => t('Video short description.'),
    '#default_value' => !empty($form_state['values']['short']) ? $form_state['values']['short'] : '',
  );
  $custom_fields = variable_get('brightcove_custom_fields', 0);
  for ($i = 0; $i < $custom_fields; ++$i) {
    $key = variable_get("brightcove_custom_fields_{$i}_key");
    $label = variable_get("brightcove_custom_fields_{$i}_label");
    $type = variable_get("brightcove_custom_fields_{$i}_type");
    $values = array_map('trim', explode("\n", (string) variable_get("brightcove_custom_fields_{$i}_values")));
    $required = variable_get("brightcove_custom_fields_{$i}_required");
    $typedic = array(
      'text' => 'textfield',
      'list' => 'select',
    );
    if (isset($typedic[$type])) {
      $form["custom_field_{$i}"] = array(
        '#type' => $typedic[$type],
        '#title' => t($label),
        '#key' => $key,
        '#required' => (bool) $required,
      ) + ($type == 'list' ? array(
        '#options' => drupal_map_assoc($values),
      ) : array());
    }
  }
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Advanced attributes'),
  );
  $form['advanced']['tags'] = array(
    '#type' => 'textfield',
    '#title' => t('Tags'),
    '#description' => t('Associated tags, separated by comma.'),
    '#default_value' => !empty($form_state['values']['tags']) ? $form_state['values']['tags'] : '',
  );
  $form['advanced']['long'] = array(
    '#type' => 'textarea',
    '#rows' => 4,
    '#title' => t('Long description'),
    '#description' => t('Video long description.'),
    '#default_value' => !empty($form_state['values']['long']) ? $form_state['values']['long'] : '',
  );
  $form['advanced']['linktext'] = array(
    '#type' => 'textfield',
    '#title' => t('Related link text'),
    '#description' => t('Related link description or text.'),
    '#default_value' => !empty($form_state['values']['linktext']) ? $form_state['values']['linktext'] : '',
  );
  $form['advanced']['linkurl'] = array(
    '#type' => 'textfield',
    '#title' => t('Related link url'),
    '#description' => t('Related link URL.'),
    '#default_value' => !empty($form_state['values']['linkurl']) ? $form_state['values']['linkurl'] : '',
  );
  $form['advanced']['economics'] = array(
    '#type' => 'select',
    '#title' => t('Economic model'),
    '#options' => array(
      BRIGHTCOVE_ECONOMICS_FREE => t('No advertising'),
      BRIGHTCOVE_ECONOMICS_AD_SUPPORTED => t('Advertising'),
    ),
    '#description' => t('If set to "Advertising", ads may be shown when viewers watch this video'),
    '#default_value' => !empty($form_state['values']['economics']) ? $form_state['values']['economics'] : BRIGHTCOVE_ECONOMICS_FREE,
  );
  $form['advanced']['encode_to'] = array(
    '#type' => 'select',
    '#title' => t('Video container'),
    '#options' => array(
      'MP4' => t('H.264 (MP4)'),
      'FLV' => t('VP6 (FLV)'),
    ),
    '#description' => t('Output rendition encoding'),
    '#default_value' => variable_get('brightcove_encode_to', 'MP4'),
  );
  $form['logo_overlay'] = array(
    '#type' => 'fieldset',
    '#title' => t('Logo overlay'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['logo_overlay']['logo_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable logo overlay'),
  );
  $form['logo_overlay']['logo_image_upload'] = array(
    '#type' => 'managed_file',
    '#title' => t('Upload logo image'),
    '#description' => t('Transparent PNG or GIF'),
    '#states' => array(
      'invisible' => array(
        ':input[name="logo_enable"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#upload_location' => 'public://brightcove/logo_images',
    '#upload_validators' => array(
      'file_validate_extensions' => array(
        0 => 'png gif',
      ),
    ),
  );
  $form['logo_overlay']['logo_link'] = array(
    '#type' => 'textfield',
    '#title' => t('Logo Link URL'),
    '#description' => t('Ex. http://www.brightcove.com'),
    '#default_value' => 'http://',
    '#states' => array(
      'invisible' => array(
        ':input[name="logo_enable"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['logo_overlay']['logo_tooltip'] = array(
    '#type' => 'textfield',
    '#title' => t('Logo tooltip'),
    '#description' => t('128 character allowed.'),
    '#maxlength' => 128,
    '#states' => array(
      'invisible' => array(
        ':input[name="logo_enable"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['logo_overlay']['logo_alignment'] = array(
    '#type' => 'select',
    '#title' => t('Logo Alignment'),
    '#options' => array(
      BRIGHTCOVE_LOGO_BOTTOM_RIGHT => t('Align bottom right'),
      BRIGHTCOVE_LOGO_BOTTOM_LEFT => t('Align bottom left'),
      BRIGHTCOVE_LOGO_TOP_LEFT => t('Align top left'),
      BRIGHTCOVE_LOGO_TOP_RIGHT => t('Align top right'),
    ),
    '#states' => array(
      'invisible' => array(
        ':input[name="logo_enable"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['logo_overlay']['logo_description'] = array(
    '#markup' => t('Logo overlay images display a logo in the corner of the video
                 playback window. Viewers can click through to a web site that
                 you specify. The image you select should be at 100% scale when
                 viewed in a 480x360 video playback window and will be scaled
                 proportionately to fit smaller videos.'),
  );
  return $form;
}