You are here

function asset_menu in Asset 5

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

Implementation of hook_menu()

File

./asset.module, line 29

Code

function asset_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'asset/widget/js',
      'callback' => 'asset_widget_js',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'type' => MENU_CALLBACK,
      'title' => t('Asset Wizard'),
      'path' => 'asset/wizard',
      'callback' => 'asset_wizard',
      'access' => user_access('create assets') || user_access('administer assets'),
    );
    $items[] = array(
      'type' => MENU_CALLBACK,
      'path' => 'asset/js/preview',
      'callback' => 'asset_js_preview',
      'access' => user_access('create assets') || user_access('administer assets'),
    );
    $items[] = array(
      'path' => 'admin/settings/asset',
      'title' => t('Asset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'asset_admin_settings',
      ),
      'access' => user_access('administer assets'),
    );
    $items[] = array(
      'path' => 'admin/settings/asset/settings',
      'title' => t('Settings'),
      'access' => user_access('administer assets'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -1,
    );
    $items[] = array(
      'path' => 'admin/settings/asset/defaults',
      'title' => t('Formatter Defaults'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'asset_admin_formatter_defaults',
      ),
      'access' => user_access('administer assets'),
      'type' => MENU_LOCAL_TASK,
    );
    foreach (module_implements('asset_settings') as $module) {
      $items[] = array(
        'path' => 'admin/settings/asset/' . $module,
        'title' => $module,
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          $module . '_asset_settings',
        ),
        'access' => user_access('administer assets'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 5,
      );
    }
    $items[] = array(
      'path' => 'asset/img',
      'type' => MENU_CALLBACK,
      'callback' => 'asset_img_preview',
      'access' => user_access('create assets'),
    );
  }
  else {
    module_invoke_all('asset_formatter', 'init');
    drupal_add_css(drupal_get_path('module', 'asset') . '/asset.css');
  }
  return $items;
}