You are here

function feeds_menu in Feeds 7

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_menu()
  2. 6 feeds.module \feeds_menu()
  3. 7.2 feeds.module \feeds_menu()

Implements hook_menu().

Related topics

File

./feeds.module, line 163
Feeds - basic API functions and hook implementations.

Code

function feeds_menu() {

  // Register a callback for all feed configurations that are not attached to a content type.
  $items = array();
  foreach (feeds_importer_load_all() as $importer) {
    if (empty($importer->config['content_type'])) {
      $items['import/' . $importer->id] = array(
        'title' => $importer->config['name'],
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'feeds_import_form',
          1,
        ),
        'access callback' => 'feeds_access',
        'access arguments' => array(
          'import',
          $importer->id,
        ),
        'file' => 'feeds.pages.inc',
      );
      $items['import/' . $importer->id . '/import'] = array(
        'title' => 'Import',
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => -10,
      );
      $items['import/' . $importer->id . '/delete-items'] = array(
        'title' => 'Delete items',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'feeds_delete_tab_form',
          1,
        ),
        'access callback' => 'feeds_access',
        'access arguments' => array(
          'clear',
          $importer->id,
        ),
        'file' => 'feeds.pages.inc',
        'type' => MENU_LOCAL_TASK,
      );
    }
    else {
      $items['node/%node/import'] = array(
        'title' => 'Import',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'feeds_import_tab_form',
          1,
        ),
        'access callback' => 'feeds_access',
        'access arguments' => array(
          'import',
          1,
        ),
        'file' => 'feeds.pages.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
      );
      $items['node/%node/delete-items'] = array(
        'title' => 'Delete items',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'feeds_delete_tab_form',
          NULL,
          1,
        ),
        'access callback' => 'feeds_access',
        'access arguments' => array(
          'clear',
          1,
        ),
        'file' => 'feeds.pages.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => 11,
      );
    }
    $items += $importer->fetcher
      ->menuItem();
  }
  if (count($items)) {
    $items['import'] = array(
      'title' => 'Import',
      'page callback' => 'feeds_page',
      'access callback' => 'feeds_page_access',
      'file' => 'feeds.pages.inc',
    );
  }
  return $items;
}