Getting rid of form elements in a drupal theme function


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function themename_type_node_form($form) {
  2. if (isset($form['signup']['node_settings'])) {
  3. $form['signup']['#collapsible'] = FALSE;
  4. $form['signup']['#collapsed'] = FALSE;
  5. unset($form['signup']['node_settings']['settings']['signup_forwarding_email']);
  6. unset($form['signup']['node_settings']['settings']['signup_send_confirmation']);
  7. unset($form['signup']['node_settings']['settings']['signup_confirmation_email']);
  8. unset($form['signup']['node_settings']['settings']['signup_reminder']);
  9. unset($form['signup']['node_settings']['settings']['signup_reminder_email']);
  10. }
  11. if (isset($form['locations'][0])) {
  12. $form['locations'][0]['latitude']['#type'] = 'hidden';
  13. $form['locations'][0]['latitude']['#value'] = '';
  14. $form['locations'][0]['latitude']['#default_value'] = '';
  15. $form['locations'][0]['longitude']['#type'] = 'hidden';
  16. $form['locations'][0]['longitude']['#value'] = '';
  17. $form['locations'][0]['longitude']['#default_value'] = '';
  18.  
  19. unset($form['locations'][0]['map']);
  20. unset($form['locations'][0]['province']['#options']['xx']);
  21. $form['locations'][0]['province']['#options']['xx'] = 'OTHER';
  22. $form['locations'][0]['province']['#options']['us000'] = ' -- PLEASE CHOOSE ONE -- ';
  23. }
  24. unset($form['preview']);
  25. return drupal_render($form);
  26. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.