function feeds_page in Feeds 6
Same name and namespace in other branches
- 8.2 feeds.pages.inc \feeds_page()
- 7.2 feeds.pages.inc \feeds_page()
- 7 feeds.pages.inc \feeds_page()
Render a page of available importers.
1 string reference to 'feeds_page'
- feeds_menu in ./
feeds.module - Implementation of 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 (node_access('create', $importer->config['content_type'])) {
$link = 'node/add/' . str_replace('_', '-', $importer->config['content_type']);
$title = node_get_types('name', $importer->config['content_type']);
}
else {
continue;
}
$rows[] = array(
l($title, $link),
check_plain($importer->config['description']),
);
}
}
if (empty($rows)) {
drupal_set_message(t('There are no importers, go to <a href="@importers">Feed importers</a> to create one or enable an existing one.', array(
'@importers' => url('admin/build/feeds'),
)));
}
$header = array(
t('Import'),
t('Description'),
);
return theme('table', $header, $rows);
}