You are here

function lazyloader_admin_configure in Image Lazyloader 7.2

Admin Form: General settings

1 string reference to 'lazyloader_admin_configure'
lazyloader_menu in ./lazyloader.module
Implements hook_menu().

File

./lazyloader.admin.inc, line 14
Lazyloader Admin

Code

function lazyloader_admin_configure() {
  $form = array();
  $form['lazyloader_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enabled'),
    '#default_value' => variable_get('lazyloader_enabled', LAZYLOADER_ENABLED),
    '#description' => t('Enable/Disable Lazyloader (Useful for testing)'),
  );
  $form['lazyloader_debugging'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use development javascript'),
    '#default_value' => variable_get('lazyloader_development', LAZYLOADER_DEBUGGING),
    '#description' => t('By default lazyloader will use the minified version of the echo library. By checking this option it will use the non-minified version instead.'),
  );
  $form['lazyloader_distance'] = array(
    '#type' => 'textfield',
    '#title' => t('Distance'),
    '#default_value' => variable_get('lazyloader_distance', LAZYLOADER_DISTANCE),
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t('The distance option allows you to specify when Lazyloader should start loading your images. If you specify 0, Lazyloader will load your image as soon as it is visible in the viewport, if you want to load 1000px below or above the viewport, use 1000.'),
  );
  $form['lazyloader_load_image_delay'] = array(
    '#type' => 'textfield',
    '#title' => t('Load Image Delay'),
    '#default_value' => variable_get('lazyloader_load_image_delay', LAZYLOADER_LOAD_IMAGE_DELAY),
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t('The delay option allows you to specify a delay (in miliseconds) between the scroll event and when lazyloader will start loading the images.'),
  );
  $form['lazyloader_debounce'] = array(
    '#type' => 'checkbox',
    '#title' => t('Debounce'),
    '#default_value' => variable_get('lazyloader_debounce', LAZYLOADER_DEBOUNCE),
    '#description' => 'The debounce option prevents images from being loaded while the user is still scrolling. If you want to use the traditional delay, unselect this option.',
  );
  $form['lazyloader_unload'] = array(
    '#type' => 'checkbox',
    '#title' => t('Unload'),
    '#default_value' => variable_get('lazyloader_unload', LAZYLOADER_UNLOAD),
    '#description' => 'Checking unload option will make Lazyloader unload the images when they are no longer within the viewport (including the offset area).',
  );
  $form['lazyloader_placeholder'] = array(
    '#type' => 'textfield',
    '#title' => t('Placeholder Image'),
    '#default_value' => variable_get('lazyloader_placeholder', LAZYLOADER_PLACEHOLDER),
    '#description' => t('Path to your placeholder image, ex. sites/default/files/placeholder_image.gif. Leave it blank to use the default image.'),
  );
  $loader_dir = base_path() . drupal_get_path('module', 'lazyloader') . '/loader/';
  $loader = array(
    0 => t('None'),
  );
  for ($i = 1; $i <= 8; $i++) {
    $loader[$i] = '<img alt="Lazyloader Icon" src="' . $loader_dir . 'loader-' . $i . '.gif" />';
  }
  $loader[9] = t('Custom icon');
  $form['lazyloader_icon'] = array(
    '#type' => 'radios',
    '#title' => t('Loader Icon'),
    '#options' => $loader,
    '#default_value' => variable_get('lazyloader_icon', LAZYLOADER_ICON),
    '#description' => t('This icon will show when the actual image is not yet fully loaded.'),
  );
  $form['lazyloader_custom_icon_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom Loader Icon'),
    '#default_value' => variable_get('lazyloader_custom_icon_path', LAZYLOADER_CUSTOM_ICON_PATH),
    '#description' => t('Relative path to the custom loading icon you wish to use, ex. <em>profiles/MYPROFILE/custom_loader_icon.gif</em>.'),
    '#states' => array(
      'visible' => array(
        ':input[name="lazyloader_icon"]' => array(
          'value' => 9,
        ),
      ),
    ),
  );
  $form['actions']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset'),
    '#weight' => 10,
  );
  $form['#submit'][] = 'lazyloader_admin_configure_submit';
  return system_settings_form($form);
}