PHP 摆脱drupal主题函数中的表单元素

Posted

tags:

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

function themename_type_node_form($form) {
  if (isset($form['signup']['node_settings'])) {
    $form['signup']['#collapsible'] = FALSE;
    $form['signup']['#collapsed'] = FALSE;
    unset($form['signup']['node_settings']['settings']['signup_forwarding_email']);
    unset($form['signup']['node_settings']['settings']['signup_send_confirmation']);
    unset($form['signup']['node_settings']['settings']['signup_confirmation_email']);
    unset($form['signup']['node_settings']['settings']['signup_reminder']);
    unset($form['signup']['node_settings']['settings']['signup_reminder_email']);       
  }
  if (isset($form['locations'][0])) {
    $form['locations'][0]['latitude']['#type'] = 'hidden';
    $form['locations'][0]['latitude']['#value'] = '';
    $form['locations'][0]['latitude']['#default_value'] = '';
    $form['locations'][0]['longitude']['#type'] = 'hidden';
    $form['locations'][0]['longitude']['#value'] = '';
    $form['locations'][0]['longitude']['#default_value'] = '';
    
    unset($form['locations'][0]['map']);
    unset($form['locations'][0]['province']['#options']['xx']);
    $form['locations'][0]['province']['#options']['xx'] = 'OTHER';
    $form['locations'][0]['province']['#options']['us000'] = ' -- PLEASE CHOOSE ONE -- ';
}
  unset($form['preview']);
  return drupal_render($form);
}

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

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

PHP Drupal主题中的显示块

自定义字段的drupal主题化视图:PHP代码

无法摆脱 HTML 表格边框 - 带有屏幕截图和 jfFiddle

任何节点的 Drupal 主题模板文件

用于 Drupal 视图主题的 PHP