Jump to:
| Project: | Views PHP |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I have a view that is showing a node teaser. In this view I have a single Views PHP sort block that utilizes $row1 and $row2. The values of $row1 and $row2 are invalid.
I have another another view that is showing fields. The values of $row1 and $row2 appear correct.
Looking at php_sort() in views_php_handler_sort.inc, I see that the raw rows from the db $row1 and $row2 are "normalized".
It looks like this normalization assumes that the output of the view will be fields?
foreach (array('row1' => 'normalized_row1', 'row2' => 'normalized_row2') as $name => $normalized_name) {
$$normalized_name = new stdClass;
foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
$$normalized_name->$field = isset($$name->{$handler->field_alias}) ? $$name->{$handler->field_alias} : NULL;
}
}What I will do to hack around this issue is simply pass the original $row1 and $row2 (that get passed into the php_sort function) into $this->php_sort_function as 2 extra parameters on the end. That way I can have access to both the "normalized" $row1 and $row2 and the original $row1 and $row2.
Not sure what an actual solution would look like.
Comments
#1
I'm facing the same issue. Did you find any nice workaround for this?