function video_optmetadata_form_alter in Video 6
Same name and namespace in other branches
- 5 plugins/video_optmetadata/video_optmetadata.module \video_optmetadata_form_alter()
- 6.2 plugins/video_optmetadata/video_optmetadata.module \video_optmetadata_form_alter()
Implementation of hook_form_alter() We use this to add some fields to the video creation form. In those fields users will be able to insert some video metadatas.
File
- plugins/
video_optmetadata/ video_optmetadata.module, line 38 - Enable addition of optional metadata on video nodes created by video module.
Code
function video_optmetadata_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'video_node_form' && isset($form['video']) && user_access('insert optional metadata')) {
// get node object
$node = $form['#node'];
// Optional Video Metadata. We display this group expanded only if displaying of optional metadata is enabled.
$form['metadata'] = array(
'#type' => 'fieldset',
'#title' => t('Optional Metadata'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => -16,
'#description' => t('Insert here the metadata informations.'),
);
$form['metadata']['video_bitrate'] = array(
'#type' => 'textfield',
'#title' => t('Video Bitrate'),
'#length' => 11,
'#maxlength' => 11,
'#default_value' => $node->video_bitrate,
'#description' => t('Video bitrate in kbits/sec.'),
);
$form['metadata']['audio_bitrate'] = array(
'#type' => 'textfield',
'#title' => t('Audio Bitrate'),
'#length' => 11,
'#maxlength' => 11,
'#default_value' => $node->audio_bitrate,
'#description' => t('Audio bitrate in kbits/sec.'),
);
$form['metadata']['audio_sampling_rate'] = array(
'#type' => 'select',
'#title' => t('Audio Sampling Rate'),
'#options' => array(
0 => 'none',
8000 => '8 kHz',
11025 => '11 kHz',
16000 => '16 kHz',
22050 => '22 kHz',
32000 => '32 kHz',
44100 => '44.1 kHz',
48000 => '48 kHz',
96000 => '96 kHz',
192400 => '192 kHz',
),
'#default_value' => $node->audio_sampling_rate,
'#description' => t('Integer value of audio sampling rate in Hz.'),
);
$form['metadata']['audio_channels'] = array(
'#type' => 'select',
'#title' => t('Audio Channels'),
'#options' => array(
'' => 'none',
'5.1' => t('5.1'),
'stereo' => t('Stereo'),
'mono' => t('Mono'),
),
'#default_value' => $node->audio_channels,
);
// Ends Video Optional Metadata
}
}