「cssswitch」という独自のモジュールを作成しました。モジュールの管理フォーム部分を表示する独自の HTML レイアウトを作成しようとしています。hook_form_alter() を使用してフォーム要素を変更する方法は理解していますが、フォーム レイアウト全体を作成して、いくつかのフィールドを隣り合わせに表示する必要があります。ノードのフロントエンドビューを theme_cssswitch_display() で表示する方法のようなものが必要なようですが、ノードの管理部分が必要です。
function cssswitch_form_alter(&$form, $form_state, $form_id) {
switch($form_id) {
case 'cssswitch_node_form':
$form['hour_start']['#prefix'] = '<div class="start-box">';
$form['ampm_start']['#suffix'] = '</div>';
$form['ampm_start']['#attributes'] = array("style" => "border-width:2px;");
break;
}
}
function cssswitch_theme() {
return array(
'cssswitch_display' => array(
'arguments' => array('node'),
),
);
}
// to display the view of the node
function theme_cssswitch_display($node) {
$output = '<div class="cssswitch-cssfilename">Filename: '.
check_plain($node->cssfilename). '</div>';
$output .= '<div class="cssswitch-time_start">Start: '.
check_plain($node->hour_start). ':'.check_plain($node->minute_start).' '.check_plain($node->ampm_start).'</div>';
$output .= '<div class="cssswitch-time_end">End: '.
check_plain($node->hour_end). ':'.check_plain($node->minute_end).' '.check_plain($node->ampm_end).'</div>';
return $output;
}
助けてくれてありがとう