function boost_block_db_settings_form in Boost 6
1 string reference to 'boost_block_db_settings_form'
- boost_block in ./
boost.module - Implementation of hook_block().
File
- ./
boost.module, line 2315 - Provides static file caching for Drupal text output. Pages, Feeds, ect...
Code
function boost_block_db_settings_form() {
// set info
$period = drupal_map_assoc(array(
-1,
0,
60,
180,
300,
600,
900,
1800,
2700,
3600,
10800,
21600,
32400,
43200,
64800,
86400,
2 * 86400,
3 * 86400,
4 * 86400,
5 * 86400,
6 * 86400,
604800,
2 * 604800,
3 * 604800,
4 * 604800,
8 * 604800,
16 * 604800,
52 * 604800,
), 'format_interval');
$period[0] = '<' . t('none') . '>';
$period[-1] = t('default');
//$info = boost_get_db(boost_file_path($GLOBALS['_boost_path']));
$router_item = _boost_get_menu_router();
$settings = boost_get_settings_db($router_item);
$default = 0;
foreach ($settings as $key => $value) {
if ($value != NULL) {
$info = $value;
$default = $key;
break;
}
}
if (!isset($info)) {
$info['lifetime'] = -1;
$info['push'] = -1;
}
// create form
$form['boost_db_settings']['lifetime'] = array(
'#type' => 'select',
'#title' => t('Maximum cache lifetime'),
'#default_value' => $info['lifetime'],
'#options' => $period,
'#description' => t('Default: %default', array(
'%default' => format_interval(BOOST_CACHE_LIFETIME),
)),
);
$form['boost_db_settings']['push'] = array(
'#type' => 'select',
'#title' => t('Preemptive Cache'),
'#default_value' => $info['push'],
'#options' => array(
-1 => 'default',
0 => 'No',
1 => 'Yes',
),
);
$form['boost_db_settings']['selection'] = array(
'#type' => 'select',
'#title' => t('Scope'),
'#default_value' => $default,
'#options' => array(
0 => 'Page ID: ' . $router_item['page_id'],
1 => 'Content Type: ' . $router_item['page_type'],
2 => 'Content Container: ' . $router_item['page_callback'],
),
);
$form['boost_db_settings']['send'] = array(
'#type' => 'submit',
'#value' => t('Set Configuration'),
'#submit' => array(
'boost_block_db_settings_form_submit',
),
);
$lifetime = isset($settings[0]['lifetime']) ? $settings[0]['lifetime'] : -1;
$form['boost_db_rm_settings']['id'] = array(
'#type' => 'checkbox',
'#title' => t('Page ID'),
'#default_value' => $settings[0] != NULL ? FALSE : TRUE,
'#disabled' => $settings[0] != NULL ? FALSE : TRUE,
'#description' => t('%lifetime - %id', array(
'%lifetime' => $period[$lifetime],
'%id' => $router_item['page_id'],
)),
);
$form['boost_db_rm_settings']['id_value'] = array(
'#type' => 'hidden',
'#title' => t('id_value'),
'#default_value' => $settings[0] != NULL ? $settings[0]['csid'] : FALSE,
'#disabled' => $settings[0] != NULL ? FALSE : TRUE,
);
$lifetime = isset($settings[1]['lifetime']) ? $settings[1]['lifetime'] : -1;
$form['boost_db_rm_settings']['type'] = array(
'#type' => 'checkbox',
'#title' => t('Content Type'),
'#default_value' => $settings[1] != NULL ? FALSE : TRUE,
'#disabled' => $settings[1] != NULL ? FALSE : TRUE,
'#description' => t('%lifetime - %type', array(
'%lifetime' => $period[$lifetime],
'%type' => $router_item['page_type'],
)),
);
$form['boost_db_rm_settings']['type_value'] = array(
'#type' => 'hidden',
'#title' => t('type_value'),
'#default_value' => $settings[1] != NULL ? $settings[1]['csid'] : FALSE,
'#disabled' => $settings[1] != NULL ? FALSE : TRUE,
);
$lifetime = isset($settings[2]['lifetime']) ? $settings[1]['lifetime'] : -1;
$form['boost_db_rm_settings']['container'] = array(
'#type' => 'checkbox',
'#title' => t('Content Container'),
'#default_value' => $settings[2] != NULL ? FALSE : TRUE,
'#disabled' => $settings[2] != NULL ? FALSE : TRUE,
'#description' => t('%lifetime - %callback', array(
'%lifetime' => $period[$lifetime],
'%callback' => $router_item['page_callback'],
)),
);
$form['boost_db_rm_settings']['container_value'] = array(
'#type' => 'hidden',
'#title' => t('container_value'),
'#default_value' => $settings[2] != NULL ? $settings[2]['csid'] : FALSE,
'#disabled' => $settings[2] != NULL ? FALSE : TRUE,
);
$form['boost_db_rm_settings']['send'] = array(
'#type' => 'submit',
'#value' => t('Delete Configuration'),
'#submit' => array(
'boost_block_db_rm_settings_form_submit',
),
'#description' => t('Check the box to delete it'),
);
return $form;
}