You are here

function imagecache_profiles_form_alter in ImageCache Profiles 5

Implementation of hook_form_alter().

File

./imagecache_profiles.module, line 73

Code

function imagecache_profiles_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'user_edit':
      $form['#validate']['imagecache_profiles_user_edit_validate'] = array();
      $form['#submit']['imagecache_profiles_user_edit_submit'] = array();
      break;
    case 'user_admin_settings':

      // Load imagecache presets
      $result = db_query('SELECT presetid, presetname FROM {imagecache_preset} ORDER BY presetname');
      $presets[] = '';
      while ($row = db_fetch_array($result)) {
        $presets[$row['presetid']] .= $row['presetname'];
      }
      $form['pictures']['user_picture_imagecache_profiles'] = array(
        '#type' => 'select',
        '#title' => t('Set user profile picture size with this ImageCache preset'),
        '#default_value' => variable_get('user_picture_imagecache_profiles', ''),
        '#options' => $presets,
        '#description' => t("This will set the picture size when viewing a user's profile page."),
      );
      $form['pictures']['user_picture_imagecache_comments'] = array(
        '#type' => 'select',
        '#title' => t('Set the user picture size within comments with this ImageCache preset'),
        '#default_value' => variable_get('user_picture_imagecache_comments', ''),
        '#options' => $presets,
        '#description' => t("This will set the picture size when viewing a comment post."),
      );
      $form['pictures']['user_picture_imagecache_profiles_default'] = array(
        '#type' => 'select',
        '#title' => t('Set default user picture size with this ImageCache preset'),
        '#default_value' => variable_get('user_picture_imagecache_profiles_default', ''),
        '#options' => $presets,
        '#description' => t('This will set the default user picture size throughout the site.'),
      );
      $form['pictures']['user_picture_imagecache_profiles_min_width'] = array(
        '#type' => 'textfield',
        '#title' => t('Picture minimum width'),
        '#default_value' => variable_get('user_picture_imagecache_profiles_min_width', ''),
        '#description' => t('Minimum width dimension for picture, in pixels.'),
        '#size' => 10,
      );
      $form['pictures']['user_picture_imagecache_profiles_min_height'] = array(
        '#type' => 'textfield',
        '#title' => t('Picture minimum height'),
        '#default_value' => variable_get('user_picture_imagecache_profiles_min_height', ''),
        '#description' => t('Minimum height dimension for picture, in pixels.'),
        '#size' => 10,
      );
      $form['#submit']['imagecache_profiles_user_admin_settings_submit'] = array();
      break;
  }
}