function video_settings_form_validate in Video 6
Same name and namespace in other branches
- 5 video.module \video_settings_form_validate()
- 6.2 video.module \video_settings_form_validate()
Form API callback to validate the upload settings form.
Keeps the use from showing the play tab or the play link if they have chosen to display the video in the node body.
Parameters
$form_id: The identifier of the form
$form_values: form values from the settings page
File
- ./
video.module, line 370 - video.module
Code
function video_settings_form_validate($form, &$form_state) {
//print_r($form_state['values']); die;
// if admin set a name for a resolution he also have to set its value
while ($i <= 4) {
if ($form_state['values']["video_resolution_{$i}_name"] != '' && $form_state['values']["video_resolution_{$i}_value"] == '') {
form_set_error("video_resolution_{$i}_value", t('You have to set a value for resolution %res_num if you want to enable it.', array(
'%res_num' => $i,
)));
}
if ($form_state['values']["video_resolution_{$i}_value"] != '' && !preg_match('/^[0-9]{2,4}x[0-9]{2,4}$/', $form_state['values']["video_resolution_{$i}_value"])) {
// check valid resolution value
form_set_error("video_resolution_{$i}_value", t('You have to set valid value for resolution %res_num if you want to enable it. A valid value is 400x300', array(
'%res_num' => $i,
)));
}
$i++;
}
// for future use
}