You are here

function views_handler_filter_user_relationships_type::value_form in User Relationships 6

Same name and namespace in other branches
  1. 7 user_relationship_views/views_handler_filter_user_relationships_type.inc \views_handler_filter_user_relationships_type::value_form()

File

user_relationship_views/views_handler_filter_user_relationships_type.inc, line 12
User Relationships Views integration. Filter handler for relationship types, with autocomplete for type names. Modeled after views_handler_filter_user_name. @author Alex Karshakevich http://drupal.org/user/183217

Class

views_handler_filter_user_relationships_type
@file User Relationships Views integration. Filter handler for relationship types, with autocomplete for type names. Modeled after views_handler_filter_user_name. @author Alex Karshakevich http://drupal.org/user/183217

Code

function value_form(&$form, &$form_state) {
  $values = array();
  if ($this->value) {
    $result = db_query("SELECT * FROM {user_relationship_types} rt WHERE rtid IN (" . implode(', ', $this->value) . ")");
    while ($rtype = db_fetch_object($result)) {
      $values[] = $rtype->name;
    }
  }
  sort($values);
  $default_value = implode(', ', $values);
  $form['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Relationship types'),
    '#description' => t('Enter a comma separated list of types.'),
    '#default_value' => $default_value,
    //ajax callback is implemented in this module
    '#autocomplete_path' => 'admin/views/ajax/autocomplete/user_relationships_type',
  );
}