Skip to content

Instantly share code, notes, and snippets.

@isholgueras
Created August 6, 2012 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isholgueras/3271864 to your computer and use it in GitHub Desktop.
Save isholgueras/3271864 to your computer and use it in GitHub Desktop.
Add fields of an entity to a form
<?php
$form['#prefix'] = '<div id="wrapper-form">';
$form['#suffix'] = '</div>';
$form['hidden_tipo'] = array(
'#type' => 'hidden',
'#value' => $tipo,
);
$form['nombre'] = array(
'#type' => 'textfield',
'#title' => 'Nombre',
'#description' => 'Nombre',
'#size' => 60,
'#maxlength' => 100,
'#required' => TRUE,
);
$account = new stdClass;
$account->is_new = TRUE;
field_attach_form('user', $account, $form, $form_state);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment