You are here

function uc_stock_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_stock/uc_stock.module \uc_stock_menu()
  2. 7.3 uc_stock/uc_stock.module \uc_stock_menu()

Implementation of hook_menu().

File

uc_stock/uc_stock.module, line 38

Code

function uc_stock_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/store/reports/stock',
      'title' => t('Stock reports'),
      'description' => t('View reports for product stock.'),
      'callback' => 'uc_stock_report',
      'access' => user_access('view reports'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings/stock',
      'title' => t('Stock settings'),
      'description' => t('View the stock settings.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_stock_settings_form',
      ),
      'access' => user_access('administer products'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    $items[] = array(
      'path' => 'node/' . arg(1) . '/edit/stock',
      'title' => t('Stock'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_stock_edit_form',
        arg(1),
      ),
      'access' => user_access('administer products'),
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
  }
  return $items;
}