function lexicon_paths_and_titles_form in Lexicon 6
1 string reference to 'lexicon_paths_and_titles_form'
- lexicon_menu in ./
lexicon.module - Implementation of hook_menu().
File
- ./
lexicon.admin.inc, line 458 - Lexicon administration functions and forms.
Code
function lexicon_paths_and_titles_form() {
$form = array();
drupal_add_js(drupal_get_path('module', 'lexicon') . '/js/lexicon.js', 'module');
$vids = array();
$vids = variable_get('lexicon_vids', array());
if (!$vids) {
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.'));
}
$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) {
$result = db_query('SELECT name FROM {vocabulary} WHERE vid = ' . $vid);
$vocabulary = db_fetch_array($result);
$vocabulary_name = filter_xss_admin($vocabulary['name']);
$form['paths_and_titles_' . $vid] = array(
'#type' => 'fieldset',
'#title' => t('Path and title settings for ') . $vocabulary_name,
'#collapsible' => FALSE,
);
$form['paths_and_titles_' . $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>lexicon/' . $vid . '</em>.',
'#required' => TRUE,
);
$form['paths_and_titles_' . $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>' . $vocabulary_name . '</em>.',
'#required' => TRUE,
);
}
}
$form['lexicon_clear_menu_cache_on_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Clear the cache when settings are submitted.'),
'#default_value' => TRUE,
'#description' => t('Changes in the paths and titles are only visible when the menucache is flushed. This setting ensures that the menucache 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,
);
return $form;
}