
Photo by Rain Breaw
So we needed to change the titles of the tabs in the product/edit form in Ubercart.
Lyle got us started with some code and David Blum finished it up for us. This will change the tab titles in one product type but not all of them:
/**
* Implementation of hook_menu_alter()
*/
function custom_module_menu_alter(&$items) {
$items['node/%node/edit/product']['title callback'] = 'custom_module_tab_callback';
$items['node/%node/edit/product']['title arguments'] = array(1, 'product');
$items['node/%node/edit/attributes']['title callback'] = 'custom_module_tab_callback';
$items['node/%node/edit/attributes']['title arguments'] = array(1, 'attributes');
$items['node/%node/edit/attributes/add']['title callback'] = 'custom_module_tab_callback';
$items['node/%node/edit/attributes/add']['title arguments'] = array(1, 'attributes');
$items['node/%node/edit/options']['title callback'] = 'custom_module_tab_callback';
$items['node/%node/edit/options']['title arguments'] = array(1, 'options');
$items['node/%node/edit/adjustments']['title callback'] = 'custom_module_tab_callback';
$items['node/%node/edit/adjustments']['title arguments'] = array(1, 'adjustments');
$items['node/%node/edit/features']['access callback'] = 'custom_module_tab_access';
$items['node/%node/edit/features']['access arguments'] = array(1);
}
/**
* Callback function to provide new tab titles
*/
function custom_module_tab_callback($node, $item) {
if ($node->type == 'lessons') {
switch ($item) {
case 'product':
return t('Lesson');
case 'attributes':
return t('Types');
case 'options':
return t('Prices');
case 'adjustments':
return t('Advanced');
}
}
else {
switch ($item) {
case 'product':
return t('Product');
case 'attributes':
return t('Attributes');
case 'options':
return t('Options');
case 'adjustments':
return t('Adjustments');
}
}
}
Thank you David Blum and Lyle! You guys ROCK!