function esi_max_age_options in ESI: Edge Side Includes 6.2
Same name and namespace in other branches
- 7.3 esi.module \esi_max_age_options()
Get a list of possible max age (ttl) choices.
3 calls to esi_max_age_options()
- esi_admin_settings_form in ./
esi.admin.inc - Admin settings form
- esi_esi_cache_settings_form in plugins/
cache/ esi.inc - esi_form_block_admin_configure_alter in ./
esi.module - Implementation of hook_form_FORM_ID_alter(). for block_admin_configure Add ESI-configuration options to the block-config pages.
File
- ./
esi.inc, line 178 - Helper functions for the ESI module.
Code
function esi_max_age_options($current_max_age) {
$options = drupal_map_assoc(array(
0,
5,
15,
30,
60,
120,
180,
240,
300,
600,
900,
1200,
1800,
3600,
7200,
14400,
28800,
43200,
64800,
86400,
86400 * 2,
86400 * 3,
86400 * 4,
86400 * 5,
86400 * 6,
86400 * 7,
), 'format_interval');
// If the given max age isn't one of our options, add the current max age as a custom option.
if (!isset($options[$current_max_age])) {
$options[$current_max_age] = t('Custom: @time', array(
'@time' => format_interval($current_max_age),
));
ksort($options);
}
$options[0] = '<' . t('none') . '>';
return $options;
}