function datex_api_admin_form in Datex 7
Provides administration form for datex API module (menu callback).
1 string reference to 'datex_api_admin_form'
- datex_api_menu in datex_api/
datex_api.module - Implements hook_menu().
File
- datex_api/
datex_api.module, line 54
Code
function datex_api_admin_form() {
$options = array(
DATEX_USE_INTL => t('Use PHP-INTL'),
!DATEX_USE_INTL => t('Use datex internal methods.'),
);
// Use PHP-Intl or not.
$form['datex_api_intl'] = array(
'#type' => 'radios',
'#title' => t('Date conversion method'),
'#default_value' => variable_get('datex_api_intl', 0),
'#description' => t('Which method datex should use. Intl is experimental'),
'#options' => $options,
);
// JQuery widgets in admin forms.
$options = array(
FALSE => t('Do not use widgets'),
TRUE => t('Add widgets'),
);
$form['datex_jquery'] = array(
'#type' => 'radios',
'#title' => t('Use jQuery widgets in forms.'),
'#default_value' => variable_get('datex_jquery', 0),
'#description' => t('If a jQuery date widget should be added to forms, Such as node add/edit form. This option does not affect date module.'),
'#options' => $options,
);
if (!module_exists('libraries')) {
$status = t('Can not use datex jquery, Libraries module is missing.');
$ok = 0;
}
elseif (TRUE) {
$status = t('Can not use datex jquery, Library files are missing from sites/all/libararies.');
$ok = 0;
}
else {
$status = t('Everything is OK and datex widget will work.');
$ok = 1;
}
$form['datex_status'] = array(
'#type' => 'markup',
'#markup' => t('Current datex jquery status: ') . '<h4>' . $status . '</h4>',
);
if (!$ok) {
$form['datex_jquery']['#disabled'] = TRUE;
$form['datex_jquery']['#default_value'] = 0;
}
$options = array();
foreach (language_list() as $lang) {
$options[$lang->language] = $lang->name . '(' . $lang->native . ')';
}
$form['datex_api_enabled_langs'] = array(
'#type' => 'checkboxes',
'#title' => t('Enabled languages'),
'#default_value' => variable_get('datex_api_enabled_langs', array(
'fa' => 'fa',
)),
'#description' => t("Drupal's date will be displayed in Jalali only in selected languages"),
'#options' => $options,
);
return system_settings_form($form);
}