カスタム モジュールを使用したフォームが、お問い合わせページに表示されません。.module
ファイルと.info
ファイルを作成し、モジュールもアクティブにしました。以下は、.module
ファイルに含めたコードです
function custom_form_module_form($form,&$form_state) {
$form['name'] = array(
'#type' => 'textfield',
);
$form['company'] = array(
'#type' => 'textfield',
);
$form['phone'] = array(
'#type' => 'textfield',
);
$form['email'] = array(
'#type' => 'textfield',
);
$form['message'] = array(
'#type' => 'textfield',
);
return $form;
}
そして私のtemplate.phpファイルで
function custom_form_module_form_theme($existing, $type, $theme, $path) {
$items['custom_form_module_form'] = array(
'render element' => 'form',
'template' => 'page--contact-us',
'path' => drupal_get_path('theme', 'escorts').'/templates');
return $items;
}
私page--contact-us.tpl.php
の場合、次の行を使用してフォームの個別のフィールドを呼び出しましたが、機能しませんでした。
<?php echo drupal_render($form['name']); ?>
「ここcustom_form_module=my module name
とpage--contact-us.tpl.php=my template file
そしてescorts=my theme name
」