You are here

function wsfields_views_handler_filter::post_execute in Web Service Data 7

Run after the view is executed, before the result is cached.

This gives all the handlers some time to modify values. This is primarily used so that handlers that pull up secondary data can put it in the $values so that the raw data can be utilized externally.

Overrides views_handler::post_execute

File

modules/wsfields_views/handlers/wsfields_views_handler_filter.inc, line 13

Class

wsfields_views_handler_filter
Handle a WSField filtering.

Code

function post_execute(&$values) {
  $field = substr($this->field, 0, -1 * strlen('_filter'));
  $entity_type = $this->table;
  $entity_info = entity_get_info($entity_type);
  $key = $entity_info['entity keys']['id'];
  $map = array();
  $ids = array();
  foreach ($values as $location => $value) {
    $ids[] = $value->{$key};
    $map[$value->{$key}] = $location;
  }
  $entities = entity_load($entity_type, $ids);
  $index = array();
  foreach ($entities as $id => $entity) {
    $lang = current($entity->{$field});
    $delta = current($lang);
    if ($this
      ->filter_out($delta['value'])) {
      unset($values[$map[$id]]);
    }
  }
}