You are here

function asset_menu in Asset 6

Same name and namespace in other branches
  1. 5.2 asset.module \asset_menu()
  2. 5 asset.module \asset_menu()
  3. 7 asset.module \asset_menu()

Implementation of hook_menu()

File

./asset.module, line 21

Code

function asset_menu() {
  $items = array();
  $w = 0;

  // administer menu items
  $items['admin/settings/asset'] = array(
    'title' => t('Asset'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'asset_admin_settings',
    ),
    'access arguments' => array(
      'administer assets',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'inc/asset.admin.inc',
  );
  $items['admin/settings/asset/settings'] = array(
    'title' => t('Settings'),
    'access arguments' => array(
      'administer assets',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => $w++,
    'file' => 'inc/asset.admin.inc',
  );
  $items['admin/settings/asset/defaults'] = array(
    'title' => t('Formatter Defaults'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'asset_admin_formatter_defaults',
    ),
    'access arguments' => array(
      'administer assets',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => $w++,
    'file' => 'inc/asset.admin.inc',
  );
  foreach (module_implements('asset_settings') as $module) {
    $items['admin/settings/asset/' . $module] = array(
      'title' => $module,
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        $module . '_asset_settings',
      ),
      'access arguments' => array(
        'administer assets',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => $w++,
      'file' => 'inc/asset.admin.inc',
    );
  }

  // commin menu items
  $items['asset/widget/js'] = array(
    'page callback' => 'asset_widget_js',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['asset/wizard'] = array(
    'title' => t('Asset Wizard'),
    'page callback' => 'asset_wizard',
    'access callback' => call_user_func(create_function('', "return (user_access('create assets') || user_access('administer assets'));")),
    'type' => MENU_CALLBACK,
  );
  $items['asset/js/preview'] = array(
    'page callback' => 'asset_js_preview',
    'access callback' => call_user_func(create_function('', "return (user_access('create assets') || user_access('administer assets'));")),
    'type' => MENU_CALLBACK,
  );
  $items['asset/img'] = array(
    'page callback' => 'asset_img_preview',
    'access arguments' => array(
      'administer assets',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}