Here is a problem in views_php which is used for filtering entries. Some entries are shown without title and ids are messed.

Comments

dealancer’s picture

Project: Entity reference » Views PHP
Version: 7.x-1.0-rc5 » 7.x-1.x-dev

Looks like there is similar issue for 6.x version of views php http://drupal.org/node/1166234

dealancer’s picture

This problem happens in render() in entityreference_plugin_style.inc when calling runing code:

  $this->row_plugin->render($values)

This code renders wrong values.

dealancer’s picture

Title: Could not work in with views_php fielter » Entity reference could not work with views_php filter
dealancer’s picture

Looks like problem happens when updating row index in a wrong way:


$this->view->row_index++

dealancer’s picture

Project: Views PHP » Entity reference

This is a quick sketch of a patch, which requires more testing.

@@ -45,19 +45,17 @@ class entityreference_plugin_style extends views_plugin_style {
 
     // Group the rows according to the grouping field, if specified.
     $sets = $this->render_grouping($this->view->result, $this->options['grouping']);
-
     // Grab the alias of the 'id' field added by entityreference_plugin_display.
     $id_field_alias = $this->display->handler->id_field_alias;
 
     // @todo We don't display grouping info for now. Could be useful for select
     // widget, though.
     $results = array();
-    $this->view->row_index = 0;
     foreach ($sets as $records) {
-      foreach ($records as $values) {
+      foreach ($records as $index => $values) {
+        $this->view->row_index = $index;
         // Sanitize html, remove line breaks and extra whitespace.
         $results[$values->{$id_field_alias}] = filter_xss_admin(preg_replace('/\s\s+/', ' ', str_replace("\n", '', $this->row_plugin->render(
-        $this->view->row_index++;
       }
     }
     unset($this->view->row_index);
dealancer’s picture

StatusFileSize
new1.21 KB
dealancer’s picture

Status: Active » Needs review
andypost’s picture

Is it possible to provide a test for this? Patch looks sane.

damien tournoud’s picture

Looks reasonable.

podarok’s picture

Status: Needs review » Reviewed & tested by the community

#6 +1RTBC

damien tournoud’s picture

Status: Reviewed & tested by the community » Fixed

Merged into 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.