You are here

function crm_core_contact_ui_form in CRM Core 7

Form callback: create or edit a contact.


$contact: The contact object to edit or for a create form an empty contact object with only a contact type defined.

1 call to crm_core_contact_ui_form()
crm_core_contact_join_into_household_action_form in modules/crm_core_contact/crm_core_contact.module
Form builder for creating a household.
3 string references to 'crm_core_contact_ui_form'
crm_core_contact_entity_ui_get_form_wrapper in modules/crm_core_contact_ui/
Wrapper around entity_ui_get_form().
crm_core_contact_ui_form_wrapper in modules/crm_core_contact_ui/
crm_core_contact_ui_menu in modules/crm_core_contact_ui/crm_core_contact_ui.module
Implements hook_menu().


modules/crm_core_contact_ui/, line 62


function crm_core_contact_ui_form($form, &$form_state, $contact) {

  // Ensure this include file is loaded when the form is rebuilt from the cache.
  $form_state['build_info']['file'] = drupal_get_path('module', 'crm_core_contact_ui') . '/';

  // Add the field related form elements.
  $form_state['crm_core_contact'] = $contact;
  field_attach_form('crm_core_contact', $contact, $form, $form_state);
  $form['actions'] = array(
    '#type' => 'actions',

  // We add the form's #submit array to this button along with the actual submit
  // handler to preserve any submit handlers added by a form callback_wrapper.
  $submit = array();
  if (!empty($form['#submit'])) {
    $submit += $form['#submit'];
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => crm_core_contact_ui_save_contact_button_name($contact->type),
    '#submit' => $submit + array(

  // Show delete button if entity exists and user has appropriate permission
  if (!empty($contact->contact_id) && entity_access('delete', 'crm_core_contact', $contact)) {
    $form['actions']['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
      '#submit' => array(

  // We append the validate handler to #validate in case a form callback_wrapper
  // is used to add validate handlers earlier.
  $form['#validate'][] = 'crm_core_contact_ui_form_validate';
  return $form;