You are here

function similarterms_handler_argument_node_nid::options_form in Similar By Terms 7.2

Same name and namespace in other branches
  1. 6.2 views/similarterms_handler_argument_node_nid.inc \similarterms_handler_argument_node_nid::options_form()

Build the options form.

Overrides views_handler_argument_numeric::options_form

File

views/similarterms_handler_argument_node_nid.inc, line 38

Class

similarterms_handler_argument_node_nid
Argument handler to accept a node id. based on node_handler_argument_node_nid except that it doesn't add a where clause to the query.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  unset($form['not']);
  $vocabularies = array();
  $result = db_query('SELECT vid, machine_name,name FROM {taxonomy_vocabulary} ORDER BY weight');
  foreach ($result as $vocabulary) {
    $vocabularies[$vocabulary->machine_name] = $vocabulary->name;
  }
  $form['similarterms'] = array(
    '#type' => 'fieldset',
    '#title' => t('Similarity by Terms'),
    '#collapsible' => FALSE,
  );
  $form['vocabularies'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Limit similarity to terms within these vocabularies'),
    '#description' => t('Choosing any vocabularies here will limit the terms used to calculate similarity. It is usually best NOT to limit the terms, but in some cases this is necessary. Leave all checkboxes unselected to not limit terms.'),
    '#options' => $vocabularies,
    '#default_value' => empty($this->options['vocabularies']) ? array() : $this->options['vocabularies'],
    '#fieldset' => 'similarterms',
  );
  $form['include_args'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include argument node(s) in results'),
    '#description' => t('If selected, the node(s) passed as the argument will be included in the view results.'),
    '#default_value' => !empty($this->options['include_args']),
    '#fieldset' => 'similarterms',
  );
}