You are here

function node_gallery_settings_form in Node Gallery 6.3

Same name and namespace in other branches
  1. 6.2 node_gallery.admin.inc \node_gallery_settings_form()

Displays the form at admin/settings/node_gallery/settings.

Return value

A FAPI form array.

1 string reference to 'node_gallery_settings_form'
node_gallery_menu in ./node_gallery.module
Implements hook_menu().

File

./node_gallery.admin.inc, line 73

Code

function node_gallery_settings_form() {
  $selected_display = variable_get('node_gallery_galleries_summary_view', serialize(array(
    'name' => 'node_gallery_gallery_summaries',
    'display_id' => 'page_1',
  )));
  $form['node_gallery_remove_orphans'] = array(
    '#type' => 'submit',
    '#weight' => -5,
    '#value' => t('Remove orphaned rows from database'),
    '#submit' => array(
      'node_gallery_delete_orphans',
    ),
  );
  $form['node_gallery_galleries_summary_view'] = array(
    '#type' => 'select',
    '#weight' => -4,
    '#title' => t('View display to use at /galleries'),
    '#description' => t("Select the display of the gallery view to be used when the /galleries URL is requested.  Only views tagged with 'node_gallery_galleries' are displayed here."),
    '#options' => node_gallery_build_views_select('node_gallery_galleries'),
    '#default_value' => $selected_display,
  );
  $form['node_gallery_plupload_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('plupload settings'),
    '#description' => t('This area defines the settings used when integrating Node Gallery with plupload.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['node_gallery_plupload_settings']['node_gallery_plupload_integration'] = array(
    '#type' => 'checkbox',
    '#weight' => 0,
    '#title' => t('Use plupload module to upload images?'),
    '#default_value' => variable_get('node_gallery_plupload_integration', TRUE),
    '#description' => t('When checked, the plupload widget will be used on the "Upload Images" tab to add new images to a gallery.'),
  );
  $form['node_gallery_plupload_settings']['node_gallery_plupload_manage_images_integration'] = array(
    '#type' => 'checkbox',
    '#weight' => 0,
    '#title' => t('Integrate plupload and the Manage Images tab?'),
    '#default_value' => variable_get('node_gallery_plupload_manage_images_integration', TRUE),
    '#description' => t('When checked, the first visit to the Manage Images tab after uploading new images will only show newly uploaded images.'),
  );
  $form['node_gallery_plupload_settings']['node_gallery_plupload_wizard'] = array(
    '#type' => 'checkbox',
    '#weight' => 0,
    '#title' => t('Add an upload wizard link to the <em>Create content</em> page?'),
    '#default_value' => variable_get('node_gallery_plupload_wizard', TRUE),
    '#description' => t('When checked, a link to the new gallery wizard will be added to the <a href="@create-content-url">Create content</a> page.', array(
      '@create-content-url' => url('node/add'),
    )),
  );
  $form['node_gallery_plupload_settings']['node_gallery_plupload_manage_images_limit'] = array(
    '#type' => 'textfield',
    '#maxlength' => 5,
    '#size' => 5,
    '#title' => t('Enter the limit on the number of images displayed after upload.'),
    '#default_value' => variable_get('node_gallery_plupload_manage_images_limit', 100),
    '#description' => t("Displaying too many images on the Manage Images tab at once will exhaust the server's memory.  This setting limits the number of images listed."),
  );
  if (!module_exists('plupload')) {
    $form['node_gallery_plupload_settings']['node_gallery_plupload_integration']['#disabled'] = TRUE;
    $form['node_gallery_plupload_settings']['node_gallery_plupload_integration']['#default_value'] = FALSE;
    $form['node_gallery_plupload_settings']['node_gallery_plupload_integration']['#description'] = t('You need to download and install the <a href="@plupload_url">plupload module</a> to enable this option.', array(
      '@plupload_url' => url('http://drupal.org/project/plupload'),
    ));
  }
  $form['node_gallery_jquery_ui_integration'] = array(
    '#type' => 'checkbox',
    '#weight' => 0,
    '#title' => t('Use jQuery UI module to sort images?'),
    '#default_value' => variable_get('node_gallery_jquery_ui_integration', TRUE),
    '#description' => t('When checked, a drag and drop interface using thumbnails will be used to sort images instead of a table of rows.'),
  );
  $form['node_gallery_sort_images_max'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of images to allow on sort images page'),
    '#default_value' => variable_get('node_gallery_sort_images_max', 750),
    '#weight' => 0,
    '#description' => t('The sort images page can require a lot of memory on both the server and the client if the gallery contains a large amount of images. If the image count exceeds this value, the form rendering will be aborted.  In most cases, the default is sufficient.'),
    '#maxlength' => 5,
    '#size' => 5,
  );
  if (!module_exists('jquery_ui')) {
    $form['node_gallery_jquery_ui_integration']['#disabled'] = TRUE;
    $form['node_gallery_jquery_ui_integration']['#default_value'] = FALSE;
    $form['node_gallery_jquery_ui_integration']['#description'] = t('You need to download and install the <a href="@jquery_ui_url">jquery_ui module</a> to enable this option.', array(
      '@jquery_ui_url' => url('http://drupal.org/project/jquery_ui'),
    ));
  }
  $form['#submit'] = array(
    'node_gallery_settings_menu_rebuild',
  );
  $form = system_settings_form($form);
  return $form;
}