You are here

function feeds_admin_menu_output_build in Feeds 7.2

Implements hook_admin_menu_output_build().

Shows available importers in the "Content" section of the admin menu. Requires the "admin_menu" module to be enabled.

Related topics

File

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

Code

function feeds_admin_menu_output_build(array &$content) {

  // Add new top-level item to the menu.
  if (!isset($content['menu'])) {
    return;
  }
  $access = FALSE;
  foreach (feeds_enabled_importers() as $importer_id) {
    if (user_access('administer feeds') || user_access("import {$importer_id} feeds")) {
      $access = TRUE;
      break;
    }
  }
  if (!$access) {
    return;
  }
  $content['menu']['admin/content']['admin/content/feeds_import'] = array(
    '#title' => t('Import'),
    '#href' => 'import',
  );
  foreach (feeds_importer_load_all() as $importer) {
    $content['menu']['admin/content']['admin/content/feeds_import'][$importer->id] = array(
      '#title' => check_plain($importer->config['name']),
      '#href' => !empty($importer->config['content_type']) ? 'node/add/' . str_replace('_', '-', $importer->config['content_type']) : 'import/' . check_plain($importer->id),
      '#access' => user_access('administer feeds') || user_access("import {$importer->id} feeds"),
    );
  }
}