跳转到主要内容
learningxm 提交于 1 December 2012

comment_form_node_form_alter两个变化:

1、$node的获取

drupal8

$node = $form_state['controller']->getEntity($form_state);

drupal7

$node = $form['#node'];

2、js的添加

drupal8

'#attached' => array( 'library' => array(array('comment', 'drupal.comment')), ),

drupal7

'#attached' => array( 'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), ),

具体代码参考api

function comment_form_node_form_alter(&$form, $form_state) {

}