function feeds_form_node_form_alter in Feeds 8.2
Same name and namespace in other branches
- 7.2 feeds.module \feeds_form_node_form_alter()
Implements hook_form_BASE_FORM_ID_alter().
Related topics
File
- ./
feeds.module, line 629 - Feeds - basic API functions and hook implementations.
Code
function feeds_form_node_form_alter(&$form, $form_state) {
$node = $form_state['controller']
->getEntity();
if ($importer_id = feeds_get_importer_id($node->type)) {
// Set title to not required, try to retrieve it from feed.
if (isset($form['title'])) {
$form['title']['#required'] = FALSE;
}
// Enable uploads.
$form['#attributes']['enctype'] = 'multipart/form-data';
// Build form.
$source = feeds_source($importer_id, empty($node->nid) ? 0 : $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;
}
}