Commit a98f6d49 authored by generalredneck's avatar generalredneck

Moving the Admin settings to admin/structure/views

parent acad5754
......@@ -4,6 +4,14 @@
* Callbacks for managing Views Natural Sort.
*/
function views_natural_sort_settings_page() {
$content = array(
'settings' => drupal_get_form('views_natural_sort_settings_form'),
'rebuild' => drupal_get_form('views_natural_sort_rebuild_index_form'),
);
return $content;
}
/**
* Form callback for Views Natural Sort Rebuild Index page.
*
......@@ -14,9 +22,17 @@ function views_natural_sort_rebuild_index_form() {
$form = array();
$form['rebuild'] = array(
'#type' => 'submit',
'#value' => t('Rebuild title index'),
'#submit' => array('views_natural_sort_rebuild_index_submit'),
'#type' => 'fieldset',
'#title' => t('Incase of Emergency'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'button' => array(
'#type' => 'submit',
'#description' => 'Incase of an emergency.',
'#value' => t('Rebuild Index'),
'#submit' => array('views_natural_sort_rebuild_index_submit'),
),
);
return $form;
......@@ -56,6 +72,12 @@ function views_natural_sort_settings_form() {
'#description' => "Checking this setting will allow sorting of days of the week in their proper order starting with the day of the week that is configurable by you and for each language.",
'#efault_value' => variable_get('views_natural_sort_days_of_the_week_enabled', FALSE),
);
$form['batch_items'] = array(
'#type' => 'textfield',
'#title' => 'Items per Batch',
'#default_value' => variable_get('views_natural_sort_rebuild_items_per_batch', '500'),
'#description' => t('The number of items a batch process will work through at a given time. Raising this number will make the batch go quicker, however, raising it too high can cause timeouts and/or memory limit errors.'),
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save Settings'),
......@@ -78,7 +100,7 @@ function views_natural_sort_settings_form_submit($form, &$form_state) {
variable_set('views_natural_sort_words_remove', $words);
variable_set('views_natural_sort_symbols_remove', $symbols);
variable_set('views_natural_sort_days_of_the_week_enabled', $form_state['values']['days_of_the_week_enabled']);
variable_set('views_natural_sort_rebuild_items_per_batch', $form_state['values']['batch_items']);
views_natural_sort_rebuild_index_submit();
}
......@@ -136,7 +158,7 @@ function views_natural_sort_rebuild_index($entry_type, &$context) {
}
}
$results = array_slice($index_entries, $sandbox['current'], 100);
$results = array_slice($index_entries, $sandbox['current'], 500);
$entity_type = '';
$field = '';
......
......@@ -24,36 +24,25 @@
*/
function views_natural_sort_menu() {
$items = array();
$items['admin/config/views_natural_sort'] = array(
'title' => 'Views Natural Sort',
'description' => 'Configuration and settings for natural sorting.',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/config/views_natural_sort/rebuild_index'] = array(
'title' => 'Rebuild Search Index',
'description' => 'Rebuild Views Natural Sort\'s search index',
'page callback' => 'drupal_get_form',
'page arguments' => array('views_natural_sort_rebuild_index_form'),
$items['admin/structure/views/settings/views_natural_sort'] = array(
'title' => 'Natural Sort Settings',
'description' => 'Set the settings for how particular transformations should behave.',
'page callback' => 'views_natural_sort_settings_page',
'access callback' => 'user_access',
'access arguments' => array('administer views'),
'file' => 'views_natural_sort.admin.inc',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_LOCAL_TASK,
);
$items['admin/config/views_natural_sort/settings'] = array(
'title' => 'Configure Natural Sort Settings',
'description' => 'Set the settings for how particular transformations should behave.',
$items['admin/structure/views/settings/views_natural_sort/rebuild_index'] = array(
'title' => 'Rebuild Search Index',
'description' => 'Rebuild Views Natural Sort\'s search index',
'page callback' => 'drupal_get_form',
'page arguments' => array('views_natural_sort_settings_form'),
'page arguments' => array('views_natural_sort_rebuild_index_form'),
'access callback' => 'user_access',
'access arguments' => array('administer views'),
'file' => 'views_natural_sort.admin.inc',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
return $items;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment