function timeago_admin in Timeago 7.2
Same name and namespace in other branches
- 5 timeago.module \timeago_admin()
- 6.2 timeago.module \timeago_admin()
- 6 timeago.module \timeago_admin()
- 7 timeago.module \timeago_admin()
The administrative settings form.
1 string reference to 'timeago_admin'
- timeago_menu in ./
timeago.module - Implements hook_menu().
File
- ./
timeago.module, line 85 - Adds support for the Timeago jQuery library.
Code
function timeago_admin($form, $form_state) {
$form['info'] = array(
'#markup' => '<p>' . t('Note that you can set Timeago as the default <a href="!datetime">date format</a>.', array(
'!datetime' => url('admin/config/regional/date-time'),
)) . ' ' . t('This will allow you to use it for all dates on the site, overriding the settings below.') . '</p>',
);
$form['timeago_node'] = array(
'#type' => 'checkbox',
'#title' => t('Use timeago for node creation dates'),
'#default_value' => variable_get('timeago_node', 1),
);
$form['timeago_comment'] = array(
'#type' => 'checkbox',
'#title' => t('Use timeago for comment creation/changed dates'),
'#default_value' => variable_get('timeago_comment', 1),
);
$form['timeago_elem'] = array(
'#type' => 'radios',
'#title' => t('Time element'),
'#default_value' => variable_get('timeago_elem', 'span'),
'#options' => array(
'span' => t('span'),
'abbr' => t('abbr'),
'time' => t('time (HTML5 only)'),
),
);
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Override Timeago script settings'),
'#collapsible' => FALSE,
);
$form['settings']['timeago_js_refresh_millis'] = array(
'#type' => 'textfield',
'#title' => t('Refresh Timeago dates after'),
'#description' => t('Timeago can update its dates without a page refresh at this interval. Leave blank or set to zero to never refresh Timeago dates.'),
'#default_value' => variable_get('timeago_js_refresh_millis', 60000),
'#field_suffix' => ' ' . t('milliseconds'),
'#element_validate' => array(
'timeago_validate_empty_or_nonnegative_integer',
),
);
$form['settings']['timeago_js_allow_future'] = array(
'#type' => 'checkbox',
'#title' => t('Allow future dates'),
'#default_value' => variable_get('timeago_js_allow_future', 1),
);
$form['settings']['timeago_js_locale_title'] = array(
'#type' => 'checkbox',
'#title' => t('Set the "title" attribute of Timeago dates to a locale-sensitive date'),
'#default_value' => variable_get('timeago_js_locale_title', 0),
'#description' => t('If this is disabled (the default) then the "title" attribute defaults to the original date that the Timeago script is replacing.'),
);
$form['settings']['timeago_js_cutoff'] = array(
'#type' => 'textfield',
'#title' => t('Do not use Timeago dates after'),
'#field_suffix' => ' ' . t('milliseconds'),
'#description' => t('Leave blank or set to zero to always use Timeago dates.'),
'#default_value' => variable_get('timeago_js_cutoff', ''),
'#element_validate' => array(
'timeago_validate_empty_or_nonnegative_integer',
),
);
$form['settings']['strings'] = array(
'#type' => 'fieldset',
'#title' => t('Strings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
if (timeago_library_detect_languages()) {
$form['settings']['strings']['warning'] = array(
'#markup' => '<div class="messages warning">' . t('JavaScript translation files have been detected in the Timeago library. The following settings will not be used unless you remove those files.') . '</div>',
);
}
// Load in and setup form items for our JavaScript variables.
$settings_vars = timeago_get_settings_variables();
foreach ($settings_vars as $js_var => $variable) {
$form['settings']['strings'][$variable['variable_name']] = array(
'#type' => 'textfield',
'#title' => $variable['title'],
'#required' => $variable['required'],
'#default_value' => variable_get($variable['variable_name'], $variable['default']),
);
}
$form['settings']['strings']['timeago_js_strings_word_separator'] = array(
'#type' => 'textfield',
'#title' => t('Word separator'),
'#default_value' => variable_get('timeago_js_strings_word_separator', ' '),
'#description' => t('By default this is set to " " (a space).'),
);
return system_settings_form($form);
}