去除drupal主题函数中的表单元素

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了去除drupal主题函数中的表单元素相关的知识,希望对你有一定的参考价值。

  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. }

以上是关于去除drupal主题函数中的表单元素的主要内容,如果未能解决你的问题,请参考以下文章

CSS 隐藏Drupal 6主题中的搜索表单标签

在Drupal6主题中隐藏搜索表单标签

网页表单中的drupal表单更改

Drupal的模块开发中的$form和$form_state参数。

Drupal Views2 暴露形式

带有表单数据的 drupal 寻呼机