You are here

function similar_admin_settings in Similar Entries 5

1 string reference to 'similar_admin_settings'
similar_menu in ./similar.module

File

./similar.module, line 48
Module that shows a block listing similar entries. NOTE: Uses MySQL's FULLTEXT indexing for MyISAM tables.

Code

function similar_admin_settings() {
  $form = array();
  $form['similar_cache'] = array(
    '#type' => 'fieldset',
    '#title' => t('Cache settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['similar_cache']['similar_cache'] = array(
    '#type' => 'radios',
    '#title' => t('Cache'),
    '#default_value' => variable_get('similar_cache', SIMILAR_CACHE_DISABLED),
    '#options' => array(
      SIMILAR_CACHE_DISABLED => t('Disabled'),
      SIMILAR_CACHE_ENABLED => t('Enabled'),
    ),
  );
  $period = drupal_map_assoc(array(
    0,
    60,
    180,
    300,
    600,
    900,
    1800,
    2700,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
  ), 'format_interval');
  $period[0] = t('none');
  $form['similar_cache']['similar_cache_lifetime'] = array(
    '#type' => 'select',
    '#title' => t('Minimum cache lifetime'),
    '#default_value' => variable_get('similar_cache_lifetime', SIMILAR_CACHE_LIFETIME),
    '#options' => $period,
    '#description' => t('The cached block items will be forced to remain in cache at least this long before they are refreshed. Otherwise, cron jobs and node updates will clear the similar entries block cache at each occurrence. The retention policy below can be used to override this setting.'),
  );
  $form['similar_cache']['retention'] = array(
    '#type' => 'fieldset',
    '#title' => 'Retention policy',
    '#collapsible' => true,
    '#collapsed' => true,
    '#description' => t('Adjust whether or not to clear the similar entries cache when node content is updated. Remember, not setting delete to force clear cache may result in broken links for cached similar entries. This policy overrides the cache lifetime. Disabling every setting in this group will give full expiration control to the cache lifetime setting.'),
  );
  $form['similar_cache']['retention']['similar_clear_on_insert'] = array(
    '#type' => 'radios',
    '#title' => t('Force clear on insert'),
    '#default_value' => variable_get('similar_clear_on_insert', 0),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
  );
  $form['similar_cache']['retention']['update'] = array(
    '#type' => 'fieldset',
    '#collapsible' => false,
  );
  $form['similar_cache']['retention']['update']['similar_clear_on_update'] = array(
    '#type' => 'radios',
    '#title' => t('Force clear on update'),
    '#default_value' => variable_get('similar_clear_on_update', 0),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
  );
  $form['similar_cache']['retention']['update']['similar_clear_node_only'] = array(
    '#type' => 'radios',
    '#title' => t('Clear node only'),
    '#default_value' => variable_get('similar_clear_node_only', 1),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#description' => t('Disabled will clear all the cached similar blocks on the system. Enabled will only clear the similar entries block cache shown on the updated node.'),
  );
  $form['similar_cache']['retention']['similar_clear_on_delete'] = array(
    '#type' => 'radios',
    '#title' => t('Force clear on deletion'),
    '#default_value' => variable_get('similar_clear_on_delete', 1),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
  );
  return system_settings_form($form);
}