commerce_customer_ui.profile_types.inc in Commerce Core 7
File
modules/customer/includes/commerce_customer_ui.profile_types.inc
View source
<?php
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();
foreach (commerce_customer_profile_types() as $type => $profile_type) {
$links = menu_contextual_links('commerce-customer-profile-type', 'admin/commerce/customer-profiles/types', array(
strtr($type, 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 (empty($rows)) {
$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,
));
}
function theme_customer_profile_type_admin_overview($variables) {
$profile_type = $variables['profile_type'];
$output = check_plain($profile_type['name']);
$output .= ' <small>' . t('(Machine name: @type)', array(
'@type' => $profile_type['type'],
)) . '</small>';
$output .= '<div class="description">' . filter_xss_admin($profile_type['description']) . '</div>';
return $output;
}