Skip to content
Snippets Groups Projects
Commit 9232a314 authored by Dave Reid's avatar Dave Reid
Browse files

Use hook_form_node_form_alter() rather than hook_form_alter().

parent effb3556
No related branches found
No related tags found
No related merge requests found
...@@ -551,26 +551,24 @@ function feeds_node_delete($node) { ...@@ -551,26 +551,24 @@ function feeds_node_delete($node) {
} }
/** /**
* Implements hook_form_alter(). * Implements hook_form_BASE_FORM_ID_alter().
*/ */
function feeds_form_alter(&$form, $form_state, $form_id) { function feeds_form_node_form_alter(&$form, $form_state) {
if (!empty($form['#node_edit_form'])) { if ($importer_id = feeds_get_importer_id($form['#node']->type)) {
if ($importer_id = feeds_get_importer_id($form['type']['#value'])) { // Set title to not required, try to retrieve it from feed.
// Set title to not required, try to retrieve it from feed. $form['title']['#required'] = FALSE;
$form['title']['#required'] = FALSE; // Enable uploads.
// Enable uploads. $form['#attributes']['enctype'] = 'multipart/form-data';
$form['#attributes']['enctype'] = 'multipart/form-data';
// Build form.
// Build form. $source = feeds_source($importer_id, empty($form['#node']->nid) ? 0 : $form['#node']->nid);
$source = feeds_source($importer_id, empty($form['nid']['#value']) ? 0 : $form['nid']['#value']); $form['feeds'] = array(
$form['feeds'] = array( '#type' => 'fieldset',
'#type' => 'fieldset', '#title' => t('Feed'),
'#title' => t('Feed'), '#tree' => TRUE,
'#tree' => TRUE, );
); $form['feeds'] += $source->configForm($form_state);
$form['feeds'] += $source->configForm($form_state); $form['#feed_id'] = $importer_id;
$form['#feed_id'] = $importer_id;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment