Matrix field does not display properly in a view where we are displaying the full node. Only the matrix field of the first node in the view is diplayed.

To replicate this problem create a few nodes, fill out matrix field data. Create a view, select "Node" for Row Style. Select "Full Node". Hit preview. Only the first matrix-field is shown.

This is most likely a problem with the formatter.

Comments

phayes’s picture

Status: Active » Needs review

Okay the problem is with the static caching in the formatter. It is only caching for each unique field, not each unique field / node combination. We can fix it like so:
Line 289

  static $rendered; //since we are rendering the whole thing in one go, we don't want to rerender for each fow, cache for each nid / field name
  $nid = $element['#node']->nid;
  
  if ($rendered[$nid][$element['#field_name']] != TRUE) {
    $rendered[$nid][$element['#field_name']] = TRUE;

This still isn't ideal as we cannot display the same table on the same page more than once, but it's a step in the right direction.

Mo’s picture

Thanks Phayes. This patch works. (I have 9 matrix fields per node.)

phayes’s picture

Status: Needs review » Reviewed & tested by the community

Please commit

aaron1234nz’s picture

Status: Reviewed & tested by the community » Fixed

Fix applied. Thanks.

Status: Fixed » Closed (fixed)

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