You are here

function gallery_assist_settings_extras in Gallery Assist 6

Build the tab with extra settings for Gallery Assist. It is used to display some general settings and the forms from the submodules.

2 string references to 'gallery_assist_settings_extras'
gallery_assist_menu in ./gallery_assist.module
Implementation of hook_menu().
gallery_assist_ui_form_alter in modules/gallery_assist_ui/gallery_assist_ui.module
Implementation of hook_form_alter().

File

./gallery_assist.admin.inc, line 778
Administration page from Gallery Assist.

Code

function gallery_assist_settings_extras() {
  global $user, $base_path;
  $import_path = file_directory_path() . '/u' . $user->uid . '/import';
  $dscan1 = file_scan_directory($import_path, '.', array(), 0, FALSE);
  $paths1 = array_keys($dscan1);
  $form = array();
  $form['gallery_assist_extras'] = array(
    '#type' => 'fieldset',
    '#title' => t('Gallery Assist Extras'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );

  //
  $form['gallery_assist_extras']['gallery_assist_upload_conf'] = array(
    '#type' => 'fieldset',
    '#title' => t('Upload proccess'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    //'#description' => t('Better only for experts.'),
    '#weight' => -50,
  );
  $form['gallery_assist_extras']['gallery_assist_upload_conf']['gallery_assist_upload_method'] = array(
    '#type' => 'select',
    '#title' => t('Files save method'),
    '#default_value' => variable_get('gallery_assist_upload_method', 1),
    '#options' => array(
      0 => t('Rename files'),
      1 => t('Replace files'),
    ),
    '#description' => 'If you choose "Replace files" existing files will be replaced by uploading files through the new file with the same name.<br>If you choose "Rename files" new files with same name as existing files will be renamed with a counter at the end.',
  );

  // Assignments
  if (user_access('administer gallery_assist')) {
    $form['gallery_assist_extras']['gallery_assist_assignments'] = array(
      '#type' => 'fieldset',
      '#title' => t('Gallery functionality assignments'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => -50,
      '#description' => t('Assign the gallery functionality to other content types.'),
    );
    $form['gallery_assist_extras']['gallery_assist_assignments'] += _gallery_assist_assignments_form();
  }
  if (module_exists('imce')) {
    $form['gallery_assist_extras']['gallery_assist_import_directories'] = array(
      '#type' => 'radios',
      //'#title' => '',
      '#options' => $paths1,
    );
  }
  $form['gallery_assist_extras']['others'] = array(
    '#type' => 'fieldset',
    '#title' => t('Others'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 40,
  );
  $form['gallery_assist_extras']['others']['gallery_assist_editform_pager_limit'] = array(
    '#type' => 'select',
    '#title' => t('Pager limit in the node edit form'),
    '#description' => t('Limit of the number of listed images in the edit form.'),
    '#default_value' => variable_get('gallery_assist_editform_pager_limit', 'none'),
    '#options' => drupal_map_assoc(array(
      'none',
      10,
      15,
      20,
      25,
      30,
      35,
      40,
      45,
      50,
    )),
  );
  $form['gallery_assist_extras']['others']['gallery_assist_forms_possition'] = array(
    '#type' => 'textfield',
    '#title' => t('Gallery Assist form fieldsets weight'),
    '#description' => t('A little help to set the weight of fieldsets.'),
    '#default_value' => variable_get('gallery_assist_forms_possition', -2),
    '#size' => 8,
  );
  $form['gallery_assist_extras']['clear_cached_data'] = array(
    '#type' => 'fieldset',
    '#title' => t('Clear cached data from Gallery Assist'),
    '#weight' => 50,
    '#description' => t('Warning: high-traffic sites with many galleries will experience performance slowdowns while cached data is rebuilt.'),
  );
  $form['gallery_assist_extras']['clear_cached_data']['gallery_assist_clearthecache'] = array(
    '#type' => 'submit',
    '#title' => t('Clear the Gallery Assist cached data'),
    '#name' => 'clearthecache',
    '#value' => t('Clear the Gallery Assist cached data'),
    '#submit' => array(
      'gallery_assist_clearthecache',
    ),
  );
  $form['submit']['save'] = array(
    '#type' => 'submit',
    '#name' => 'save',
    '#value' => t('Save'),
  );
  $form['gallery_assist_extras']['#suffix'] = '<div id="ga-devel-by">' . gallery_assist_info_line() . '</div>';
  $form['#submit'][] = 'gallery_assist_nodetypes_submit';
  $form['#validate'][] = 'gallery_assist_nodetypes_submit_validate';
  return $form;
}