biblio_handler_filter_biblio_keyword_word.inc in Bibliography Module 7
Same filename and directory in other branches
File
views/biblio_handler_filter_biblio_keyword_word.incView source
<?php
/**
*
*/
class biblio_handler_filter_biblio_keyword_word extends views_handler_filter_string {
/**
*
*/
public function has_extra_options() {
return TRUE;
}
/**
*
*/
public function get_value_options() {
$result = db_query("SELECT kd.* FROM {biblio_keyword_data} kd ORDER BY kd.word");
foreach ($result as $term) {
$this->value_options[$term->kid] = $term->word;
}
}
/**
*
*/
public function option_definition() {
$options = parent::option_definition();
$options['type'] = array(
'default' => 'textfield',
);
$options['limit'] = array(
'default' => TRUE,
);
$options['kid'] = array(
'default' => 0,
);
return $options;
}
/**
*
*/
public function extra_options_form(&$form, &$form_state) {
if ($this->options['limit']) {
// We only do this when the form is displayed so this query doesn't run
// unnecessarily just when the object is constructed.
$form['type'] = array(
'#type' => 'radios',
'#title' => t('Selection type'),
'#options' => array(
'select' => t('Dropdown'),
'textfield' => t('Autocomplete'),
),
'#default_value' => $this->options['type'],
);
}
}
/**
*
*/
public function value_form(&$form, &$form_state) {
parent::value_form($form, $form_state);
if ($this->options['type'] == 'textfield') {
/* $default = '';
if ($this->value) {
$result = db_query("SELECT * FROM {biblio_keyword} bk WHERE bk.kid IN (:kids)",
array(':kids' => implode(', ', $this->value)));
foreach ($result as $term) {
if ($default) {
$default .= ', ';
}
$default .= $term->word;
}
}
$form['value'] = array(
'#title' => t('Select keywords'),
'#type' => 'textfield',
'#default_value' => $default,
);
if ($this->options['limit']) {
$form['value']['#autocomplete_path'] = 'biblio/autocomplete/biblio_keywords';
}
*/
}
if (empty($form_state['exposed'])) {
// Retain the helper option
// $this->helper->options_form($form, $form_state);.
}
}
}
Classes
Name![]() |
Description |
---|---|
biblio_handler_filter_biblio_keyword_word |