This page is about how to create custom layout for your custom form.
Assumptions:
- Experience with PHP
- Experience with module writing
- Experience with theme writing
This document has following structure:
- Module
- mymodule.module: function mymodule_menu()
- mymodule.module: function myformgene()
- Theme
- template.php: mytheme_theme()
- template.php: mytheme_preprocess_myformname()
- mytemplate.tpl.php
Some strings, functions, etc are prefixed by 'my' to clearly show what you have to define yourself.
During development remember to clear Drupal cache so that it would reread your hooks and theme.
Module
Assume you have created module mymodule. Here you create structure of your form and method of displaying it.
mymodule.module: mymodule_menu()
By default you create menu entry for the form, which further makes structure builder function callback.
function mymodule_menu() {
return array(
'mypath' => array(
'title' => 'My title',
'page callback' => 'drupal_get_form',
'page arguments' => array('myformgene'),
'access callback' => true,
'type' => MENU_CALLBACK,
),
);
}