You are here

function feeds_imagegrabber_form_alter in Feeds Image Grabber 6

Implementation of hook_form_alter().

File

./feeds_imagegrabber.module, line 40
Grabs image for each feed-item from their respective web pages and stores it in an image field. Requires Feeds module.

Code

function feeds_imagegrabber_form_alter(&$form, $form_state, $form_id) {
  if ($form['#id'] == 'node-form') {
    if ($importer = feeds_get_importer_id($form['type']['#value'])) {

      // Use the values from $form_state if available
      if (isset($form_state['values']['feeds_imagegrabber'])) {
        $settings = $form_state['values']['feeds_imagegrabber'];
      }
      elseif (!isset($form['#node']->nid) || ($settings = feeds_imagegrabber_get_settings($form['#node']->nid)) === FALSE) {
        $settings = feeds_imagegrabber_get_default_settings();
      }
      $form['feeds_imagegrabber'] = array(
        '#type' => 'fieldset',
        '#title' => t('Feeds Image Grabber'),
        '#tree' => TRUE,
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      feeds_imagegrabber_form($form, $settings);
      $form['#validate'][] = 'feeds_imagegrabber_form_validate';
    }
  }
}