function lexicon_block_configure in Lexicon 7
Implements hook_block_configure().
File
- ./
lexicon.module, line 53 - The Lexicon module is used to create lists of terms and definitions to use on a website and optionally mark those terms in the content of the website.
Code
function lexicon_block_configure($delta) {
$form = array();
switch ($delta) {
case 'lexicon_random_term':
$vids = array();
// Get all vocabulary id's that are used as Lexicons.
$vid_list = variable_get('lexicon_vids', array());
// Get rid off any array items with value '0'.
$vid_list = array_filter($vid_list);
foreach ($vid_list as $vid) {
// Put the vocabulary in the options array.
$voc = taxonomy_vocabulary_load($vid);
$vids[$vid] = check_plain($voc->name);
}
$form['lexicon_block'] = array(
'#type' => 'fieldset',
'#title' => 'Random term settings',
);
$form['lexicon_block']['vids'] = array(
'#type' => 'checkboxes',
'#title' => t('Load from'),
'#description' => t('Select the vocabularies to load a term from.'),
'#required' => TRUE,
'#options' => $vids,
'#default_value' => variable_get('lexicon_block_lexicon_random_term_vids', array()),
);
$form['lexicon_block']['refresh_settings'] = array(
'#type' => 'fieldset',
'#title' => 'Refresh settings',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['lexicon_block']['refresh_settings']['step'] = array(
'#type' => 'select',
'#title' => t('Time unit'),
'#default_value' => variable_get('lexicon_block_lexicon_random_term_step', 0),
'#options' => array(
1 => t('seconds'),
60 => t('minutes'),
3600 => t('hours'),
86400 => t('days'),
),
);
$form['lexicon_block']['refresh_settings']['interval'] = array(
'#type' => 'textfield',
'#size' => 4,
'#maxlength' => 3,
'#default_value' => variable_get('lexicon_block_lexicon_random_term_interval', 0),
'#title' => t('Update interval'),
'#description' => t('How often do you want to load a new term? Leaving this blank or zero means that a new term is loaded every time.'),
);
$form['lexicon_block']['output_settings'] = array(
'#type' => 'fieldset',
'#title' => 'Output settings',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['lexicon_block']['output_settings']['link'] = array(
'#type' => 'checkbox',
'#title' => t('Show term name as link'),
'#default_value' => variable_get('lexicon_block_lexicon_random_term_link', TRUE),
'#description' => t('If selected, this option causes the term name to be made a link to the lexicon entry.'),
);
$form['lexicon_block']['output_settings']['trim'] = array(
'#type' => 'checkbox',
'#title' => t('Trim term description'),
'#default_value' => variable_get('lexicon_block_lexicon_random_term_trim', FALSE),
'#description' => t('If selected, this option causes the term description to be trimmed to a maximum number of characters.'),
);
$form['lexicon_block']['output_settings']['trim_fs'] = array(
'#type' => 'fieldset',
'#title' => t('Trim settings'),
'#states' => array(
'invisible' => array(
':input[name="trim"]' => array(
'checked' => FALSE,
),
),
),
);
$form['lexicon_block']['output_settings']['trim_fs']['trim_length'] = array(
'#type' => 'textfield',
'#title' => t('Trim length'),
'#size' => 4,
'#maxlength' => 3,
'#default_value' => variable_get('lexicon_block_lexicon_random_term_trim_length', 100),
'#description' => t('Enter the number of characters the description is trimmed to (note: trimming is performed word-safe).'),
);
$form['lexicon_block']['output_settings']['trim_fs']['trim_ellipsis'] = array(
'#type' => 'checkbox',
'#title' => t('Show ellipsis') . ' (…)',
'#default_value' => variable_get('lexicon_block_lexicon_random_term_trim_ellipsis', TRUE),
'#description' => t('If selected, this option will append an ellipsis to the end of the trimmed description.'),
);
$form['lexicon_block']['output_settings']['read_more_link'] = array(
'#type' => 'checkbox',
'#title' => t('Append read more link'),
'#default_value' => variable_get('lexicon_block_lexicon_random_term_read_more_link', TRUE),
'#description' => t('If selected, this option will append a read more link to the end of the description.'),
);
$form['lexicon_block']['output_settings']['rml_fs'] = array(
'#type' => 'fieldset',
'#title' => t('Read more link settings'),
'#states' => array(
'invisible' => array(
':input[name="read_more_link"]' => array(
'checked' => FALSE,
),
),
),
);
$form['lexicon_block']['output_settings']['rml_fs']['read_more_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Read more link text'),
'#size' => 60,
'#maxlength' => 60,
'#default_value' => variable_get('lexicon_block_lexicon_random_term_read_more_link_text', 'read more'),
'#description' => t('Enter the text of the read more link in English (you can use the Drupal translate interface to locallize the string).'),
);
break;
}
return $form;
}