欢迎各位兄弟 发布技术文章
这里的技术是共享的
下面是修改普通字段的标签 function shipingzhongcustom_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'kefuchat_node_form'){ //var_dump($form['field_qq_property']); //dsm($form); $form['#after_build'][] = '_afterFormForZg'; } } //就在这里修改标签 function _setTitleForZg(&$elements,$title) { foreach (element_children($elements) as $key) { if (isset($elements[$key]) && $elements[$key]) { // Recurse through all children elements. _setTitleForZg($elements[$key],$title); } } $elements['#title'] = $title; } function _afterFormForZg($form, &$form_state) { if($_GET['q']=='node/add/kefuchat/zg'){ _setTitleForZg($form['field_is_baoming'],'是否到院'); $form['field_baoming_time']['#title'] = '到院时间'; //_setTitleForZg($form['field_baoming_time'],'到院时间'); _setTitleForZg($form['field_baomingzuanye_select'],'到院专业'); _setTitleForZg($form['field_baoming_writer'],'到院填写人'); _setTitleForZg($form['field_baoming_beizhu'],'到院备注'); } return $form; } 下面是修改时间字段的标签 function shipingzhongcustom_form_alter(&$form, &$form_state, $form_id) { $form['field_baoming_time']['#pre_render'] = array('_zg_date_label'); } function _zg_date_label($element){ $element[0]['value']['#title'] = '到院时间'; $element[0]['value2']['#title'] = '到院时间'; return $element; }