function commerce_customer_ui_customer_profile_types_overview in Commerce Core 7
Menu callback: display an overview of available types.
1 string reference to 'commerce_customer_ui_customer_profile_types_overview'
- commerce_customer_ui_menu in modules/
customer/ commerce_customer_ui.module - Implements hook_menu().
File
- modules/
customer/ includes/ commerce_customer_ui.profile_types.inc, line 11
Code
function commerce_customer_ui_customer_profile_types_overview() {
drupal_add_css(drupal_get_path('module', 'commerce_customer') . '/theme/commerce_customer.admin.css');
$header = array(
t('Name'),
t('Operations'),
);
$rows = array();
// Loop through all defined customer profile types.
foreach (commerce_customer_profile_types() as $type => $profile_type) {
// Build the operation links for the current profile type.
$links = menu_contextual_links('commerce-customer-profile-type', 'admin/commerce/customer-profiles/types', array(
strtr($type, array(
'_' => '-',
)),
));
// Add the profile type's row to the table's rows array.
$rows[] = array(
theme('customer_profile_type_admin_overview', array(
'profile_type' => $profile_type,
)),
theme('links', array(
'links' => $links,
'attributes' => array(
'class' => 'links inline operations',
),
)),
);
}
// If no profile types are defined...
if (empty($rows)) {
// Add a standard empty row.
$rows[] = array(
array(
'data' => t('There are no customer profile types defined on this site.'),
'colspan' => 2,
),
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}