function brightcove_field_upload_form in Brightcove Video Connect 7.2
Same name and namespace in other branches
- 7.3 brightcove_field/brightcove_field.module \brightcove_field_upload_form()
- 7.4 brightcove_field/brightcove_field.module \brightcove_field_upload_form()
- 7.5 brightcove_field/brightcove_field.module \brightcove_field_upload_form()
Upload form. Will return a form for one video item.
1 string reference to 'brightcove_field_upload_form'
- brightcove_field_upload in brightcove_field/
brightcove_field.browse.inc
File
- brightcove_field/
brightcove_field.module, line 1105 - Brightcove field module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.
Code
function brightcove_field_upload_form($form, &$form_state) {
$form['#prefix'] = '<div id="dialog-upload-form">';
$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'] : '',
);
$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['file_upload'] = array(
'#type' => 'file',
'#title' => t('Video file'),
'#size' => 40,
);
$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'] : '',
);
$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['attach'] = array(
'#type' => 'submit',
'#value' => t('Upload'),
'#name' => 'upload',
'#ahah' => array(
'path' => 'upload/js',
'wrapper' => 'attach-wrapper',
'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
),*/
$form['submit'] = array(
'#type' => 'submit',
'#name' => 'submit-',
//'#name' => 'submit-' . $item['video_id'],
'#default_value' => t('Attach'),
'#ajax' => array(
'callback' => 'ajax_upload_dialog_close_callback',
'wrapper' => 'dialog-upload-form',
),
);
$form['#suffix'] = '</div>';
$form['#attached']['js'] = array(
drupal_get_path('module', 'brightcove_field') . '/js/brightcove.js',
);
$form['#attached']['css'] = array(
drupal_get_path('module', 'brightcove_field') . '/styles/upload.css',
);
return $form;
}