You are here

function photoswipe_admin_settings in PhotoSwipe 6

Same name and namespace in other branches
  1. 7.2 photoswipe.admin.inc \photoswipe_admin_settings()
  2. 7 photoswipe.module \photoswipe_admin_settings()

Configure global settings for PhotoSwipe.

1 string reference to 'photoswipe_admin_settings'
photoswipe_menu in ./photoswipe.module
Implementation of hook_menu().

File

./photoswipe.module, line 129

Code

function photoswipe_admin_settings() {
  $form['photoswipe']['photoswipe_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Global switch'),
    '#default_value' => variable_get('photoswipe_enabled', TRUE),
    '#description' => t('Check this box to enable PhotoSwipe on your site.'),
  );
  $form['photoswipe']['photoswipe_use_jquery'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use jQuery to load PhotoSwipe'),
    '#default_value' => variable_get('photoswipe_use_jquery', FALSE),
    '#description' => t('Warning: although this offers better support of desktop browser (in particular IE), it loads a much newer version of jQuery than the Drupal one which is likely to create incompatibility with other modules. Use at your own risk!'),
  );
  global $defaultConfigString;
  $form['photoswipe']['photoswipe_custom_config'] = array(
    '#type' => 'textarea',
    '#title' => t('Custom configuration'),
    '#default_value' => variable_get('photoswipe_custom_config', $defaultConfigString),
    '#description' => t("(Advanced users only) You can customize PhotoSwipe options using a javascript object declaration."),
  );
  $form['photoswipe']['url'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page specific activation settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['photoswipe']['url']['photoswipe_active_type'] = array(
    '#type' => 'radios',
    '#title' => t('Enable PhotoSwipe on specific pages'),
    '#options' => array(
      'disable' => 'Enable on every page except the listed pages.',
      'enable' => 'Enable on the listed pages only.',
    ),
    '#default_value' => variable_get('photoswipe_active_type', 'disable'),
  );
  $form['photoswipe']['url']['photoswipe_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('photoswipe_pages', ""),
    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.\nAdministration and edition pages are disabled by default (%admin, %node-add, %node-edit).", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
      '%admin' => 'admin*',
      '%node-add' => 'node/add/*',
      '%node-edit' => 'node/*/edit',
    )),
  );
  $form['photoswipe']['nodetype'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node types specific activation settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $options = node_get_types('names');
  $form['photoswipe']['nodetype']['photoswipe_nodetypes'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enable PhotoSwipe on specific content types'),
    '#options' => $options,
    '#default_value' => variable_get('photoswipe_nodetypes', array()),
    '#description' => t('By default, PhotoSwipe is loaded with any node type. If any is checked, it will be loaded only on these node types.'),
  );
  return system_settings_form($form);
}