You are here

function feeds_form_alter in Feeds 7

Same name and namespace in other branches
  1. 6 feeds.module \feeds_form_alter()

Implements hook_form_alter().

Related topics

File

./feeds.module, line 506
Feeds - basic API functions and hook implementations.

Code

function feeds_form_alter(&$form, $form_state, $form_id) {
  if (!empty($form['#node_edit_form'])) {
    if ($importer_id = feeds_get_importer_id($form['type']['#value'])) {

      // Set title to not required, try to retrieve it from feed.
      $form['title']['#required'] = FALSE;

      // Enable uploads.
      $form['#attributes']['enctype'] = 'multipart/form-data';

      // Build form.
      $source = feeds_source($importer_id, empty($form['nid']['#value']) ? 0 : $form['nid']['#value']);
      $form['feeds'] = array(
        '#type' => 'fieldset',
        '#title' => t('Feed'),
        '#tree' => TRUE,
      );
      $form['feeds'] += $source
        ->configForm($form_state);
      $form['#feed_id'] = $importer_id;
    }
  }
}