Drupal is showing error message for empty comments by default. how can i remove that error message. Note:- (I have not written any custom validation. It's the default validation provided by drupal module.) My changes in comment.module
if (empty($comment->cid) && empty($comment->pid)) {
if(($form['#node']->type=='iks_videos_youtube_video') || ($form['#node']- >type=='iks_videos_vimeo_video' || $form['#node']->type=='iks_videos_video')){
if(isset($form['#node']->type) && $form['#node']->type=='iks_videos_youtube_video')
{ $vtype='yt';}
else
{ $vtype='v'; }
$form['#action'] = url('video/' . $form['#node']->video_id[LANGUAGE_NONE][0]['value'] . '/'.$vtype.'/' . strtolower(str_replace(' ', '_', $form['#node']->title)));
}else{
$form['#action'] = url('comment/reply/' . $comment->nid);}
}
my custom module code
function iks_videos_form_comment_node_iks_videos_youtube_video_form_alter(&$form, $form_estate) {
if (isset($form['actions']['preview']))
unset($form['actions']['preview']);
$form['subject']['#access'] = FALSE;
unset($form['author']['mail']['#description']);
$form['#submit'][] = '_iks_videos_comment_form_submit';
}
alter form
function _iks_videos_comment_form_submit($form, &$form_estate) {
if(($form['#node']->type) && $form['#node']->type=='iks_videos_youtube_video')
$vtype='yt';
else
$vtype='v';
$form_estate['redirect'][0] = 'video/' . $form['#node']->video_id[LANGUAGE_NONE][0]['value'] . '/'.$vtype.'/' . strtolower(str_replace(' ', '_', $form['#node']->title));
}
comment.module
inhook_form_alter
. – milkovsky Jul 26 '13 at 10:32if(arg(0)=='node'){...}
– milkovsky Jul 26 '13 at 11:48#action
in form alter – milkovsky Jul 26 '13 at 12:04