drupal コメント フォームに「名前」フィールドを 1 つ追加する必要があります。これを hook_form_alter を使用して実装しました。今、フィールドが来ています。私はその位置を制御することはできません。今、それは最後に来ています。ウェイトを変更しましたが、影響はありません。
function comment_extra_form_alter(&$form, &$form_state, $form_id) {
global $user;
$output = '';
if (!$user->uid) {
switch ($form_id) {
case 'comment_form':
$form['admin']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#weight' => -1,
'#size' => 60,
'#maxlength' => 60,
'#default_value' => $author,
);
$output .= comment_render($form);
break;
}
return $output;
}
}
私を助けてください