summaryrefslogtreecommitdiff
path: root/sites/all/modules/views/modules/profile/views_handler_filter_profile_selection.inc
blob: d3403c909439beab40c0e3a96156c4921644802f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

/**
 * @file
 * Definition of views_handler_filter_profile_selection.
 */

/**
 * Filter by a selection widget in the profile.
 *
 * @ingroup views_filter_handlers
 */
class views_handler_filter_profile_selection extends views_handler_filter_in_operator {
  function get_value_options() {
    if (isset($this->value_options)) {
      return;
    }

    $this->value_options = array();
    $all_options = profile_views_get_fields();
    $field = $all_options[$this->definition['fid']];

    $lines = preg_split("/[,\n\r]/", $field->options);
    foreach ($lines as $line) {
      if ($line = trim($line)) {
        $this->value_options[$line] = $line;
      }
    }
  }
}