You are here

function commerce_backoffice_product_menu_alter in Commerce Backoffice 7

Implements hook_menu_alter().

File

./commerce_backoffice_product.module, line 110

Code

function commerce_backoffice_product_menu_alter(&$items) {
  $items['admin/structure/types']['page callback'] = 'commerce_backoffice_product_node_overview_types';

  // Remove the Commerce product types UI.
  foreach ($items as $path => $item) {
    if (strpos($path, 'admin/commerce/products/types') === 0) {
      unset($items[$path]);
    }
  }

  // Transform the field UI tabs into contextual links.
  foreach (commerce_product_types() as $type => $product_type) {

    // Convert underscores to hyphens for the menu item argument.
    $type_arg = strtr($type, '_', '-');
    $items['admin/commerce/config/product-variation-types/' . $type_arg . '/fields']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
    $items['admin/commerce/config/product-variation-types/' . $type_arg . '/display']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
  }
}