In order to theme a node creation/edit form, one might typically create form-mynode.tpl.php and then add the following to template.php:

function mytheme_theme(){
  return array(
    'mynode_form' => array(
      'arguments' => array('form' => NULL),
      'template' => 'form-mynode',
    ),
  );
}

However, a Zen subtheme already has a mytheme_theme function:

/**
 * Implementation of HOOK_theme().
 */
function mytheme_theme(&$existing, $type, $theme, $path) {
  $hooks = zen_theme($existing, $type, $theme, $path);
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */
  // @TODO: Needs detailed comments. Patches welcome!
  return $hooks;
}

How should the code at the top be incorporate into this mytheme_theme function?

Comments

jasonawant’s picture

Hi,

I think I've managed to specify a new template file as follows. However, the new template file needs to live in the themes root, /sites/all/theme/your_theme/ instead of /sites/all/theme/your_theme/templates/node/ or /sites/all/theme/your_theme/templates/form.

function my_theme(&$existing, $type, $theme, $path) {
  $hooks = zen_theme($existing, $type, $theme, $path);
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */
  // @TODO: Needs detailed comments. Patches welcome!

  // Declare new template file for a node form
  $hooks['mynode_form'] = array(
    'arguments' => array('form' => NULL),
    'template' => 'form-mynode'
  );
 
  return $hooks;
}

Jason

johnalbin’s picture

Component: PHP code » layout.css
Status: Active » Closed (fixed)

There's a toggle for which theme to use for "node edit" forms. That is provided by core.