function apachesolr_mlt_block_form in Apache Solr Search 5
Same name and namespace in other branches
- 5.2 apachesolr.admin.inc \apachesolr_mlt_block_form()
- 6 apachesolr.admin.inc \apachesolr_mlt_block_form()
- 6.2 apachesolr.admin.inc \apachesolr_mlt_block_form()
function apachesolr_mlt_block_form() Allows users to create and edit moreLikeThis Blocks.
Parameters
int $block_id If editing, the id of the block to edit.:
Return value
array The form used for editing. TODO: Add term boost settings Enable the user to specify a query, rather then forcing suggestions based on the node id.
3 string references to 'apachesolr_mlt_block_form'
- apachesolr_mlt_block_form_submit in contrib/
apachesolr_mlt/ apachesolr_mlt.module - function apachesolr_mlt_block_submit()
- apachesolr_mlt_block_form_validate in contrib/
apachesolr_mlt/ apachesolr_mlt.module - function apachesolr_mlt_block_validate()
- apachesolr_mlt_menu in contrib/
apachesolr_mlt/ apachesolr_mlt.module - Implementation of hook_menu()
File
- contrib/
apachesolr_mlt/ apachesolr_mlt.module, line 141
Code
function apachesolr_mlt_block_form($block_id = NULL) {
//if editing, load the current settings for the block.
if ($block_id && is_numeric($block_id)) {
$block = apachesolr_mlt_load_block($block_id);
$form['block_id'] = array(
'#type' => 'hidden',
'#value' => $block_id,
);
}
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Block Name'),
'#description' => t('Please enter the block name. This will only be seen by the administratior'),
'#default_value' => check_plain($block['name']),
'#weight' => '-2',
);
$form['mlt.count'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of results'),
'#default_value' => $block['mlt_count'] ? $block['mlt_count'] : 5,
'#weight' => -1,
);
$form['comparison'] = array(
'#type' => 'fieldset',
'#title' => t('Comparison settings'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['comparison']['mlt_fl'] = array(
'#type' => 'checkboxes',
'#title' => t('Fields for comparison'),
'#description' => t('The fields to be used in caclulating similarity.'),
'#options' => apachesolr_mlt_get_fields(),
'#default_value' => isset($block['mlt_fl']) ? $block['mlt_fl'] : array(
'title',
'taxonomy_name',
),
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced Configuration'),
'#weight' => '1',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['advanced']['mlt_mintf'] = array(
'#type' => 'textfield',
'#title' => t('Minimum Term Frequency'),
'#description' => t('The frequency below which terms will be ignored in the source document.'),
'#default_value' => $block['mlt_mintf'] ? (int) $block['mlt_mintf'] : 1,
);
$form['advanced']['mlt_mindf'] = array(
'#type' => 'textfield',
'#title' => t('Minimum Document Frequency'),
'#description' => t('The frequency at which words will be ignored which do not occur in at least this many documents.'),
'#default_value' => $block['mlt_mindf'] ? (int) $block['mlt_mindf'] : 1,
);
$form['advanced']['mlt_minwl'] = array(
'#type' => 'textfield',
'#title' => t('Minimum Word Length'),
'#description' => 'Words must be at least this long or they will be ignored.',
'#default_value' => $block['mlt_minwl'] ? (int) $block['mlt_minwl'] : 3,
);
$form['advanced']['mlt_maxwl'] = array(
'#type' => 'textfield',
'#title' => t('Maximum World Length'),
'#description' => t('Words above this length will be ignored.'),
'#default_value' => $block['mlt_maxwl'] ? (int) $block['mlt_maxwl'] : 15,
);
$form['advanced']['mlt_maxqt'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of query terms'),
'#description' => t('The maximum number of query terms that will be included in any generated query. Lower numbers will result in fewer recommendations but perform better.'),
'#default_value' => $block['mlt_maxqt'] ? (int) $block['mlt_maxqt'] : 30,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => '5',
);
$form['#redirect'] = 'admin/settings/apachesolr_mlt';
return $form;
}