Poll Form Drupal

 Customized Poll Form


 if ($form_id == 'poll_form') {
        $form['choice']['widget']['add_more']['#value']= '+ Add Option';
        $form['actions']['submit']['#value'] =' Post Poll';
        $form['question']['widget']['0']['value']['#title_display']='none';
        $form['question']['widget']['0']['value']['#description_display']='none';
        $form['choice']['widget']['#description_display']='none';
         $form['actions']['cancel']['#value'] = t('Undo');
        unset($form['choice']['widget']['#description']);
        $form['actions']['submit']['#submit'][] = 'register_poll_submit';
        
        
    }

 

Button Names change in view poll list

 

 $poll_view = strpos($form_id, 'poll_view_form_') ;     
      if( $poll_view !== false){       
        $form['actions']['cancel']['#value'] = t('Undo Vote');
        $form['actions']['vote']['#attributes']['class'][] = 'vote_poll_btn';
      } 


step 1- find repetitive form id of form in view 

step 2- then apply condition 



Comments