You are here

function feeds_imagegrabber_form in Feeds Image Grabber 7

Same name and namespace in other branches
  1. 6 feeds_imagegrabber.module \feeds_imagegrabber_form()

Appends the form with the Feeds Image Grabber form using the passed default settings.

Parameters

$form: The form to append under the 'feeds_imagegrabber' fieldset.

$default_settings: The default values of the form elements.

2 calls to feeds_imagegrabber_form()
feeds_imagegrabber_admin in ./feeds_imagegrabber.module
Implementation of the default settings admin form.
feeds_imagegrabber_form_node_form_alter in ./feeds_imagegrabber.module
Implements hook_form_BASE_FORM_ID_alter().

File

./feeds_imagegrabber.module, line 314
Grabs images for items imported using the feeds module.

Code

function feeds_imagegrabber_form(&$form, $default_settings) {
  $form['feeds_imagegrabber']['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Feeds Image Grabber'),
    '#description' => t('Check if you want to download images from URL of the feed items.'),
    '#default_value' => $default_settings['enabled'],
  );
  $form['feeds_imagegrabber']['id_class'] = array(
    '#type' => 'radios',
    '#title' => t('Search for the images between the tag which is identified by'),
    '#options' => array(
      t('None, search the whole web-page for the images.'),
      t('an Id'),
      t('a Class'),
    ),
    '#default_value' => $default_settings['id_class'],
  );
  $form['feeds_imagegrabber']['id_class_desc'] = array(
    '#type' => 'textfield',
    '#title' => t('<i>Id</i> or <i>Class</i> of the HTML tag (Leave empty if you selected <i>None</i> above.)'),
    '#default_value' => $default_settings['id_class_desc'],
    '#description' => t('Separate multiple classes with spaces (as present in the HTML)'),
    '#maxlength' => 100,
  );
  $form['feeds_imagegrabber']['feeling_lucky'] = array(
    '#type' => 'radios',
    '#title' => t('Feeling lucky, huh?'),
    '#options' => array(
      t('No, select the images based of their size (large to small) between the tag.'),
      t('Yes, select the images based on their position (top to bottom) between the tag. (Recommended)'),
    ),
    '#default_value' => $default_settings['feeling_lucky'],
  );
  $form['feeds_imagegrabber']['exec_time'] = array(
    '#type' => 'select',
    '#title' => t('Execution time[%]'),
    '#options' => drupal_map_assoc(array(
      10,
      20,
      30,
      50,
      75,
    )),
    '#default_value' => $default_settings['exec_time'],
    '#description' => t('Select the percentage of maximum PHP execution time to take while grabbing images for a feed item.'),
  );
}