function glossary_general_settings_form in Glossary 7
Same name and namespace in other branches
- 5.2 glossary.module \glossary_general_settings_form()
- 5 glossary.module \glossary_general_settings_form()
- 6 glossary.admin.inc \glossary_general_settings_form()
Menu callback for settings.
1 string reference to 'glossary_general_settings_form'
- glossary_menu in ./
glossary.module - Implements hook_menu().
File
- ./
glossary.admin.inc, line 14 - Glossary administration functions and forms.
Code
function glossary_general_settings_form($form, &$form_state) {
$form = array();
drupal_add_js(drupal_get_path('module', 'glossary') . '/glossary.js');
$mb_status = extension_loaded('mbstring') ? t('enabled') : t('disabled');
$overload = ini_get('mbstring.func_overload') ? t('enabled') : t('disabled');
$mb = '<p>' . t('Multibyte string support is !status; multibyte function overload is !overload.', array(
'!status' => $mb_status,
'!overload' => $overload,
)) . '</p>';
$form['mb_stuff'] = array(
'#type' => 'markup',
'#markup' => $mb,
);
$form['general'] = array(
'#type' => 'fieldset',
'#title' => t('General settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['general']['glossary_disable_indicator'] = array(
'#type' => 'checkbox',
'#title' => t('Allow the user to disable glossary links.'),
'#default_value' => variable_get('glossary_disable_indicator', FALSE),
'#description' => t('Determines whether or not the individual user may disable the Glossary indicators.'),
);
$form['general']['glossary_hide_menus'] = array(
'#type' => 'checkbox',
'#title' => t('Hide unused text format tabs.'),
'#default_value' => variable_get('glossary_hide_menus', FALSE),
'#description' => t('Determines whether or not to hide settings tabs for text formats that are not glossary-enabled. Changing this setting may require you to clear the cache_menu table.'),
);
$click_options = array(
t('Show only the single term.'),
t('Advance the whole glossary to the term.'),
);
$form['general']['glossary_click_option'] = array(
'#type' => 'radios',
'#title' => t('Clicking on a term link will'),
'#options' => $click_options,
'#default_value' => variable_get('glossary_click_option', 0),
'#description' => t('Changing this setting may require you to clear the cache_filter.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['general']['glossary_show_edit'] = array(
'#type' => 'checkbox',
'#title' => t('Show "edit" link.'),
'#default_value' => variable_get('glossary_show_edit', TRUE),
'#description' => t('Determines whether or not to show an "edit term" link for each entry.'),
);
$form['general']['glossary_show_search'] = array(
'#type' => 'checkbox',
'#title' => t('Show "search" link.'),
'#default_value' => variable_get('glossary_show_search', TRUE),
'#description' => t('Determines whether or not to show an "search for term" link for each entry.'),
);
$form['glossary_page'] = array(
'#type' => 'fieldset',
'#title' => t('Glossary Page'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// This next setting cannot vary by format since the glossary overview doesn't
// care or know about text formats.
$form['glossary_page']['glossary_page_per_letter'] = array(
'#type' => 'checkbox',
'#title' => t('Show glossary across many smaller pages.'),
'#default_value' => variable_get('glossary_page_per_letter', FALSE),
'#description' => t('Do you want to show all terms on one glossary page or break up the glossary into a page for each first letter (i.e. many pages).'),
);
$form['glossary_page']['glossary_separate_letters'] = array(
'#type' => 'checkbox',
'#title' => t('Separate letters.'),
'#default_value' => variable_get('glossary_separate_letters', FALSE),
'#description' => t('Separate the terms by the first letters. This will create a large letter at the beginning of each section.'),
);
$form['glossary_page']['glossary_allow_no_description'] = array(
'#type' => 'checkbox',
'#title' => t('Show glossary terms even if there is no description.'),
'#default_value' => variable_get('glossary_allow_no_description', FALSE),
'#description' => t('By default, Glossary omits terms from the list if there is no term description. This setting overrides that. This is useful on free-tagging vocabularies that rarely get descriptions.'),
);
$form['glossary_page']['glossary_show_description'] = array(
'#type' => 'checkbox',
'#title' => t('Show glossary term descriptions on the Glossary page.'),
'#default_value' => variable_get('glossary_show_description', FALSE),
'#description' => t('Glossary term descriptions may be large and/or include pictures, therefore the Glossary page can take a long time to load if you include the full descriptions.'),
);
$form['glossary_page']['glossary_show_detailed'] = array(
'#type' => 'checkbox',
'#title' => t('Show detailed descriptions on the Glossary page.'),
'#default_value' => variable_get('glossary_show_detailed', FALSE),
'#description' => t('Glossary terms may have nodes associated with them. This option allows you to include the teasers of those nodes under the term.'),
);
$form['glossary_page']['glossary_link_related'] = array(
'#type' => 'checkbox',
'#title' => t('Link related terms on the Glossary page.'),
'#default_value' => variable_get('glossary_link_related', TRUE),
'#description' => t('Do you want terms that are related to link to each other? The type of link is determined by "Clicking on a term link will" above.'),
);
$form['glossary_page']['glossary_link_related_how'] = array(
'#type' => 'checkbox',
'#title' => t('Related terms link one-way.'),
'#default_value' => variable_get('glossary_link_related_how', FALSE),
'#description' => t('By default, links are two way, that is if "a" is related to "b" then "b" is also related to "a". This option changes that so that "b" points to "a" only if it is set explicitly for the term. Requires "Link related" above to be selected.'),
'#prefix' => '<div class="glossary_link_related_how">',
'#suffix' => '</div>',
);
$form['glossary_page']['glossary_term_class'] = array(
'#type' => 'textfield',
'#title' => t('Term link class'),
'#default_value' => variable_get('glossary_term_class', 'glossary-term'),
'#description' => t('This is the style class that will be used for "acronym," "abbr," and "hovertip" links. It should only be used by those with specific site standards.'),
);
global $user;
$format_list = filter_formats($user);
$formats = array(
filter_default_format() => '-default-',
);
foreach ($format_list as $number => $filter) {
$formats[$number] = $filter->name;
}
$form['glossary_page']['glossary_default_filter'] = array(
'#type' => 'radios',
'#options' => $formats,
'#title' => t('Default text format'),
'#default_value' => variable_get('glossary_default_filter', filter_default_format()),
'#description' => t('This will be used as the default text format.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
return system_settings_form($form);
}