I am creating a custom module for a Drupal 7 site and I need to create a form, using the form hook, and then include it in a template in the custom module.
I created a simple form in my .module file:
function my_login_form($form, &$form_state) {
$form['email_address'] = array(
'#type' => 'textfield',
'#attributes' => array('placeholder' => t('Email Address')),
);
$form['phone'] = array(
'#type' => 'password',
'#attributes' => array('placeholder' => t('Password')),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Login',
);
return $form;
}
In my hook_menu() I have a route created and the 'page callback' pointed to the function:
function my_login(){
return theme('my_login_template');
}
In my hook_theme() function I have it pointed to the .tpl:
function my_theme(){
return array(
'my_login_template' => array(
'template' => 'login',
),
);
}
How do I get the my_login_form into the login.tpl.php file?
Thank you for any help you can give or any place you can point me to.