function lexicon_pages_settings_form in Lexicon 7
Lexicon pages settings form.
1 string reference to 'lexicon_pages_settings_form'
- lexicon_menu in ./
lexicon.module - Implements hook_menu().
File
- includes/
lexicon.admin.inc, line 507 - Lexicon administration functions and forms.
Code
function lexicon_pages_settings_form($form, &$form_state) {
$form = array();
$vids = variable_get('lexicon_vids', array());
$vids_setup = FALSE;
$form['vids'] = array(
'#type' => 'value',
'#value' => $vids,
);
foreach ($vids as $vid) {
// Don't create form-items for vocabularies that have not been setup as
// Lexicon vocabularies.
if ($vid != 0) {
$vids_setup = TRUE;
$result = db_query('SELECT name FROM {taxonomy_vocabulary} WHERE vid = :vid', array(
':vid' => $vid,
));
$vocabulary = $result
->fetch();
$vocabulary_name = filter_xss_admin($vocabulary->name);
$form['lexicon_page_enabled_' . $vid] = array(
'#type' => 'checkbox',
'#title' => t('Enable a Lexicon page for the vocabulary %vocabulary_name', array(
'%vocabulary_name' => $vocabulary_name,
)),
'#default_value' => variable_get('lexicon_page_enabled_' . $vid, TRUE),
'#description' => t('Determines if a Lexicon page is enabled for the vocabulary. Default is TRUE.'),
);
$form['page_settings_' . $vid] = array(
'#type' => 'fieldset',
'#title' => t('Page settings for %vocabulary_name', array(
'%vocabulary_name' => $vocabulary_name,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#states' => array(
'invisible' => array(
':input[name="lexicon_page_enabled_' . $vid . '"]' => array(
'checked' => FALSE,
),
),
),
);
$form['page_settings_' . $vid]['lexicon_path_' . $vid] = array(
'#type' => 'textfield',
'#title' => t('The path of the lexicon for this vocabulary'),
'#default_value' => variable_get('lexicon_path_' . $vid, 'lexicon/' . $vid),
'#description' => t('Determines the path that is used for the lexicon page for this vocabulary. Default is: <em>%path</em>.', array(
'%path' => 'lexicon/' . $vid,
)),
'#required' => TRUE,
);
$form['page_settings_' . $vid]['lexicon_title_' . $vid] = array(
'#type' => 'textfield',
'#title' => t('The title of the lexicon for this vocabulary'),
'#default_value' => variable_get('lexicon_title_' . $vid, $vocabulary_name),
'#description' => t('Determines the title that is used for the lexicon page for this vocabulary. Default is: <em>%name</em>.', array(
'%name' => $vocabulary_name,
)),
'#required' => TRUE,
);
$introduction_text = '';
$introduction_text_format = variable_get('lexicon_introduction_' . $vid, NULL);
if ($introduction_text_format != NULL) {
$introduction_text = $introduction_text_format['value'];
}
$form['page_settings_' . $vid]['lexicon_introduction_' . $vid] = array(
'#type' => 'text_format',
'#title' => t('The optional introduction text for this vocabulary'),
'#default_value' => $introduction_text,
'#description' => t('The optional introduction text that is displayed at the top of the Lexicon overview or, when the Lexicon is split over multiple pages, is shown on the Lexicon start page.', array(
'%name' => $vocabulary_name,
)),
'#required' => FALSE,
);
}
}
if ($vids_setup) {
$form['lexicon_clear_menu_cache_on_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Clear the menu cache when settings are submitted.'),
'#default_value' => TRUE,
'#description' => t('Changes in the paths and titles are only visible when the menu cache is flushed. This setting ensures that the menu cache is flushed when the settings are submitted.'),
'#prefix' => '<div class="lexicon_clear_menu_cache_on_submit">',
'#suffix' => '</div>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 5,
);
}
else {
drupal_set_message(t('No vocabularies were found. Until you set up, and select, at least one vocabulary for Lexicon, no settings can be entered.'));
}
return $form;
}