You are here

function entity_metadata_form_user in Entity API 7

Callback to get the form of a user account.

1 string reference to 'entity_metadata_form_user'
_entity_info_add_metadata in ./entity.module
Adds metadata and callbacks for core entities to the entity info.

File

modules/callbacks.inc, line 1022
Provides various callbacks for the whole core module integration.

Code

function entity_metadata_form_user($account) {

  // If $account->uid is set then we want a user edit form.
  // Otherwise we want the user register form.
  if (isset($account->uid)) {
    $form_id = 'user_profile_form';
    form_load_include($form_state, 'inc', 'user', 'user.pages');
  }
  else {
    $form_id = 'user_register_form';
  }
  $form_state['build_info']['args'] = array(
    $account,
  );
  return drupal_build_form($form_id, $form_state);
}