You are here

function crm_core_contact_ui_add_page in CRM Core 7

Show a list of contact types that can be added into the CRM.

1 string reference to 'crm_core_contact_ui_add_page'
crm_core_contact_ui_menu in modules/crm_core_contact_ui/crm_core_contact_ui.module
Implements hook_menu().

File

modules/crm_core_contact_ui/crm_core_contact_ui.pages.inc, line 14

Code

function crm_core_contact_ui_add_page() {
  drupal_set_title(t('Add a contact'));
  $item = menu_get_item();
  $types = crm_core_contact_types(TRUE);
  $content = array();
  foreach ($types as $type) {
    $_content = menu_get_item($item['href'] . '/' . $type->type);

    // access check
    if ($_content['access']) {
      $content[] = $_content;
    }
  }

  // If there is only one contact type addition page we go straight to it
  if (count($content) == 1) {
    $item = array_shift($content);
    drupal_goto($item['href']);
  }
  return theme('crm_core_contact_ui_add_list', array(
    'content' => $content,
  ));
}