Created
April 23, 2014 13:32
-
-
Save ivandoric/11215326 to your computer and use it in GitHub Desktop.
drupal: user register form template
This file contains 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
<?php | |
//Add this to template.php | |
function YOURTHEME_theme(&$existing, $type, $theme, $path){ | |
$hooks = array(); | |
// Make user-register.tpl.php available | |
$hooks['user_register_form'] = array ( | |
'render element' => 'form', | |
'path' => drupal_get_path('theme','YOURTHEME'), | |
'template' => 'user-register', | |
'preprocess functions' => array('YOURTHEME_preprocess_user_register_form'), | |
); | |
return $hooks; | |
} | |
function YOURTHEME_preprocess_user_register_form(&$vars) { | |
$args = func_get_args(); | |
array_shift($args); | |
$form_state['build_info']['args'] = $args; | |
$vars['form'] = drupal_build_form('user_register_form', $form_state['build_info']['args']); | |
} | |
//###### render fields in user-register.php like this | |
print render($form['account']['name']); | |
print render($form['account']['mail']); | |
print render ($form['field_firstname']); | |
print render ($form['field_lastname']); | |
//Don't forget to add this to make the form usable | |
print drupal_render($form['actions']); | |
print drupal_render($form['form_build_id']); | |
print drupal_render($form['form_id']); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment