function aggregator_form_feed
Same name and namespace in other branches
- 7.x drupal-7.x/modules/aggregator/aggregator.admin.inc \aggregator_form_feed()
Form builder; Generate a form to add/edit feed sources.
See also
aggregator_form_feed_validate()
Related topics
1 string reference to 'aggregator_form_feed'
- aggregator_menu in drupal-6.x/
modules/ aggregator/ aggregator.module - Implementation of hook_menu().
Archivo
- drupal-6.x/
modules/ aggregator/ aggregator.admin.inc, line 62 - Admin page callbacks for the aggregator module.
Código
function aggregator_form_feed(&$form_state, $edit = array('refresh' => 900, 'title' => '', 'url' => '', 'fid' => NULL)) {
$period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
if ($edit['refresh'] == '') {
$edit['refresh'] = 3600;
}
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $edit['title'],
'#maxlength' => 255,
'#description' => t('The name of the feed (or the name of the website providing the feed).'),
'#required' => TRUE,
);
$form['url'] = array(
'#type' => 'textfield',
'#title' => t('URL'),
'#default_value' => $edit['url'],
'#maxlength' => 255,
'#description' => t('The fully-qualified URL of the feed.'),
'#required' => TRUE,
);
$form['refresh'] = array(
'#type' => 'select',
'#title' => t('Update interval'),
'#default_value' => $edit['refresh'],
'#options' => $period,
'#description' => t('The length of time between feed updates. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array('@cron' => url('admin/reports/status'))),
);
// Handling of categories:
$options = array();
$values = array();
$categories = db_query('SELECT c.cid, c.title, f.fid FROM {aggregator_category} c LEFT JOIN {aggregator_category_feed} f ON c.cid = f.cid AND f.fid = %d ORDER BY title', $edit['fid']);
while ($category = db_fetch_object($categories)) {
$options[$category->cid] = check_plain($category->title);
if ($category->fid) {
$values[] = $category->cid;
}
}
if ($options) {
$form['category'] = array(
'#type' => 'checkboxes',
'#title' => t('Categorize news items'),
'#default_value' => $values,
'#options' => $options,
'#description' => t('New feed items are automatically filed in the checked categories.'),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
if ($edit['fid']) {
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
);
$form['fid'] = array(
'#type' => 'hidden',
'#value' => $edit['fid'],
);
}
return $form;
}