You are here

function asset_menu in Asset 7

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

Implements hook_menu().

File

./asset.module, line 291
Asset module.

Code

function asset_menu() {
  $items = array();
  $items['admin/content/assets/add'] = array(
    'page callback' => 'assets_add_page',
    'file' => 'includes/asset.admin.inc',
    'title callback' => '_assets_form_action_title',
    'title arguments' => array(
      'add',
      'asset',
    ),
    'page arguments' => array(),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'create',
      'asset',
    ),
  );
  foreach (assets_get_types() as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $items['admin/content/assets/add/' . $type_url_str] = array(
      'page callback' => 'assets_add',
      'page arguments' => array(
        $type->type,
      ),
      'access callback' => 'asset_creation_access',
      'access arguments' => array(
        $type->type,
      ),
      'file' => 'includes/asset.admin.inc',
      'title callback' => '_assets_form_page_title',
      'title arguments' => array(
        'asset_' . $type->type,
      ),
      'weight' => $type->weight,
    );
  }
  $items['admin/content/assets/view/%asset'] = array(
    'page callback' => 'asset_view_asset',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'asset_access_view_page',
    'access arguments' => array(
      4,
    ),
    'theme callback' => 'asset_get_frontend_theme',
    'file' => 'includes/asset.admin.inc',
  );
  $items['admin/assets/add/%'] = array(
    'title' => 'Media assets',
    'title callback' => '_assets_form_page_title',
    'title arguments' => array(
      3,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'assets_wysiwyg_form',
      'add',
      3,
    ),
    'access callback' => 'asset_creation_access',
    'access arguments' => array(
      3,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  $items['admin/assets/edit/%asset/%/%'] = array(
    'title' => 'Edit asset',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'assets_wysiwyg_form',
      'edit',
      3,
      4,
      5,
    ),
    'access callback' => 'asset_edition_access',
    'access arguments' => array(
      3,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  $items['admin/assets/override'] = array(
    'title' => 'Override asset',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'assets_override_form',
    ),
    // For now if user has access to insert he will has access to override.
    'access callback' => 'asset_insert_asset_access',
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  $items['admin/assets/tag/%/%/%'] = array(
    'theme callback' => 'asset_get_frontend_theme',
    'page callback' => '_asset_get_tag',
    'page arguments' => array(
      3,
      4,
      5,
    ),
    'access callback' => 'asset_insert_asset_access',
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
    'delivery callback' => 'asset_json_delivery',
  );

  // @todo: Add custom delivery callback for partial asset rendering to the following menu items.
  $items['admin/assets/get'] = array(
    'theme callback' => 'asset_get_frontend_theme',
    'page callback' => 'assets_get_content',
    'page arguments' => array(
      3,
    ),
    // For now if user has access to insert he will has access to view it within WYSIWYG.
    'access callback' => 'asset_insert_asset_access',
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  $items['admin/assets/getfull'] = array(
    'theme callback' => 'asset_get_frontend_theme',
    'page callback' => 'asset_get_full_content',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      'administer assets',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  $items['assets/tooltip/%asset/%'] = array(
    'theme callback' => 'asset_get_frontend_theme',
    'page callback' => 'asset_tooltip_content',
    'page arguments' => array(
      2,
      3,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'asset',
      2,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/asset.admin.inc',
  );
  return $items;
}