commerce_line_item_ui.types.inc in Commerce Core 7
File
modules/line_item/includes/commerce_line_item_ui.types.inc
View source
<?php
function commerce_line_item_ui_types_overview() {
drupal_add_css(drupal_get_path('module', 'commerce_line_item') . '/theme/commerce_line_item.admin.css');
$header = array(
t('Name'),
t('Operations'),
);
$rows = array();
foreach (commerce_line_item_types() as $type => $line_item_type) {
$type_arg = strtr($type, '_', '-');
$links = menu_contextual_links('commerce-line-item-type', 'admin/commerce/config/line-items', array(
$type_arg,
));
$rows[] = array(
theme('line_item_type_admin_overview', array(
'line_item_type' => $line_item_type,
)),
theme('links', array(
'links' => $links,
'attributes' => array(
'class' => 'links inline operations',
),
)),
);
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('There are no line item types defined by enabled modules.'),
'colspan' => 2,
),
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}
function theme_line_item_type_admin_overview($variables) {
$line_item_type = $variables['line_item_type'];
$output = check_plain($line_item_type['name']);
$output .= ' <small>' . t('(Machine name: @type)', array(
'@type' => $line_item_type['type'],
)) . '</small>';
if (!empty($line_item_type['description'])) {
$output .= '<div class="description">' . filter_xss_admin($line_item_type['description']) . '</div>';
}
return $output;
}