You are here

function feeds_page in Feeds 7

Same name and namespace in other branches
  1. 8.2 feeds.pages.inc \feeds_page()
  2. 6 feeds.pages.inc \feeds_page()
  3. 7.2 feeds.pages.inc \feeds_page()

Render a page of available importers.

1 string reference to 'feeds_page'
feeds_menu in ./feeds.module
Implements hook_menu().

File

./feeds.pages.inc, line 11
Menu callbacks, form callbacks and helpers.

Code

function feeds_page() {
  $rows = array();
  if ($importers = feeds_importer_load_all()) {
    foreach ($importers as $importer) {
      if ($importer->disabled) {
        continue;
      }
      if (!(user_access('import ' . $importer->id . ' feeds') || user_access('administer feeds'))) {
        continue;
      }
      if (empty($importer->config['content_type'])) {
        $link = 'import/' . $importer->id;
        $title = $importer->config['name'];
      }
      elseif (user_access('create ' . $importer->config['content_type'] . ' content')) {
        $link = 'node/add/' . str_replace('_', '-', $importer->config['content_type']);
        $title = node_type_get_name($importer->config['content_type']);
      }
      $rows[] = array(
        l($title, $link),
        check_plain($importer->config['description']),
      );
    }
  }
  $header = array(
    t('Import'),
    t('Description'),
  );
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}