function feeds_form_node_form_alter in Feeds 7.2
Same name and namespace in other branches
- 8.2 feeds.module \feeds_form_node_form_alter()
Implements hook_form_BASE_FORM_ID_alter().
Related topics
File
- ./
feeds.module, line 809 - Feeds - basic API functions and hook implementations.
Code
function feeds_form_node_form_alter(&$form, $form_state) {
if ($importer_id = feeds_get_importer_id($form['#node']->type)) {
// Enable uploads.
$form['#attributes']['enctype'] = 'multipart/form-data';
// Build form.
$source = feeds_source($importer_id, empty($form['#node']->nid) ? NULL : $form['#node']->nid);
$form['feeds'] = array(
'#type' => 'fieldset',
'#title' => t('Feed'),
'#tree' => TRUE,
'#weight' => 0,
);
$form['feeds'] += $source
->configForm($form_state);
$form['#feed_id'] = $importer_id;
// If the parser has support for delivering a source title, set node title
// to not required and try to retrieve it from the source if the node title
// is left empty by the user.
// @see feeds_node_validate()
if (isset($form['title']) && $source
->importer()->parser
->providesSourceTitle()) {
$form['title']['#required'] = FALSE;
}
}
}