Created
August 20, 2016 10:50
-
-
Save weeger/d2025ecffbb94c2c8b509ff821a958d0 to your computer and use it in GitHub Desktop.
Create a custom form template in Drupal 7.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function YOURMODULE_form($form, &$form_state) { | |
$form = array(); | |
$form['myfield'] = array( | |
'#type' => 'text', | |
'#value' => 'Do Cool Things', | |
); | |
return $form; | |
} | |
/** | |
* Implements hook_theme(). | |
*/ | |
function YOURMODULE_theme($existing, $type, $theme, $path) { | |
return array( | |
'YOURMODULE_form' => array( | |
'render element' => 'form', | |
'template' => 'form-template-name', | |
'path' => $path . '/templates' | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that's good but ajax does'nt work also the submit button