You are here

function sbp_nodes_sbp_settings in Search by Page 7

Same name and namespace in other branches
  1. 6 sbp_nodes.module \sbp_nodes_sbp_settings()

Implements Search by Page hook_sbp_settings().

Adds a node type selection form to the Search by Page settings page.

File

./sbp_nodes.module, line 166
Module file for Search by Page Nodes, a sub-module for Search by Page.

Code

function sbp_nodes_sbp_settings($environment) {
  $form = array();
  $form['sbp_nodes'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#weight' => -80,
    '#title' => t('Nodes'),
  );
  $form['sbp_nodes']['sbp_nodes_types_indexed'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types to index'),
    '#default_value' => search_by_page_setting_get('sbp_nodes_types_indexed', $environment, array()),
    '#options' => node_type_get_names(),
    '#description' => t('Choose which content types you would like to have indexed by Search by Page'),
  );
  $form['sbp_nodes']['sbp_nodes_display_type'] = array(
    '#type' => 'radios',
    '#title' => t('Display in search results'),
    '#default_value' => search_by_page_setting_get('sbp_nodes_display_type', $environment, 'excerpts'),
    '#options' => array(
      'excerpts' => t('Excerpts with search keywords highlighted'),
      'teasers' => t('Teasers'),
    ),
    '#description' => t('Note that search keyword highlighting may not work correctly if you are using a stemming module.'),
  );
  $form['sbp_nodes']['sbp_nodes_role'] = array(
    '#type' => 'radios',
    '#title' => t('Role for indexing'),
    '#options' => user_roles(),
    '#default_value' => search_by_page_setting_get('sbp_nodes_role', $environment, DRUPAL_ANONYMOUS_RID),
    '#weight' => 4,
    '#description' => t("When Search by Page indexes pages for searching, the pages will be viewed from the perspective and permissions of a user with this role."),
  );
  $times = array(
    '1' => t('1 second'),
    '3600' => t('1 hour'),
    '86400' => t('1 day'),
    '604800' => t('1 week'),
    '31449600' => t('1 year'),
    '0' => t('Never'),
  );
  $form['sbp_nodes']['sbp_nodes_min_time'] = array(
    '#type' => 'select',
    '#title' => t('Minimum reindexing time'),
    '#options' => $times,
    '#default_value' => search_by_page_setting_get('sbp_nodes_min_time', $environment, 1),
    '#weight' => 5,
    '#description' => t("After indexing any new and updated content items, Search by Page also cycles through previously-indexed content items, in case the rendered view of the item page has changed (even though the item itself hasn't changed, your site may include other information with the main content that can change independently). On some sites, you may want to limit the amount of reindexing, by setting a minimum time -- content will not be reindexed until this time has passed, unless the content item itself or its comments have been updated."),
  );
  $form['sbp_nodes']['sbp_nodes_max_time'] = array(
    '#type' => 'select',
    '#title' => t('Maximum reindexing time'),
    '#options' => $times,
    '#default_value' => search_by_page_setting_get('sbp_nodes_max_time', $environment, 0),
    '#weight' => 6,
    '#description' => t("Conversely to the minimum reindexing time (see above), Search by Page can be set to prioritize reindexing each content item page (by marking it as needing immediate reindexing) after this amount of time has passed. This has higher priority than the cycle-through reindexing of the setting above.") . ' ' . t('But be careful with this setting! If you set it too small, it can interfere with new content being indexed, because the reindexed content will have equal priority to content that has never been indexed. So make sure your settings allow for enough time for new content to be indexed before forcing reindexing.'),
  );
  return $form;
}