function crm_core_contact_ui_types_overview in CRM Core 7
@file Interface elements for adding, editing, and otherwise working with contact types.
File
- modules/
crm_core_contact_ui/ crm_core_contact_ui.admin.inc, line 9 - Interface elements for adding, editing, and otherwise working with contact types.
Code
function crm_core_contact_ui_types_overview() {
$header = array(
t('Name'),
t('Operations'),
);
$rows = array();
foreach (crm_core_contact_types() as $type => $contact_type) {
$links = menu_contextual_links('crm-core', 'admin/structure/crm-core/contact-types', array(
$type,
));
// @todo: this might not be the best place to hide these
if ((bool) $contact_type->disabled) {
unset($links['crm-fields'], $links['crm-display']);
}
$ops = array();
foreach ($links as $key => $link) {
$ops['links'][$key] = array(
'title' => $link['title'],
'href' => $link['href'],
);
}
$rows[] = array(
theme('crm_core_contact_ui_type_overview', array(
'contact_type' => $contact_type,
)),
theme('links__ctools_dropbutton', $ops),
);
}
crm_core_ui_ctools_add_dropbutton_files();
$build['contact_type_table'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => t('There are no contact types. <a href="@link">Add contact type</a>.', array(
'@link' => url('crm-core/admin/contact-types/manage'),
)),
);
return $build;
}