Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Create a custom form template in Drupal 7.x
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