Hi, not sure if this is an issue with Omega 4 or Commerce Kickstart, but with a fresh install of the kickstart profile, and after enabling an Omega4 subtheme and going to the cart, I'm getting a blank page and the following error.

Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, string given, called in /Users/Tom/Sites/tc_kickstart/profiles/commerce_kickstart/modules/contrib/views_megarow/theme/views-view-table.tpl.php on line 35 and defined in drupal_attributes() (line 2375 of /Users/Tom/Sites/tc_kickstart/includes/common.inc).

Comments

msmithcti’s picture

Status: Active » Closed (won't fix)

This looks like an issue with Views Megarow passing a string to drupal_attributes() rather than an array. When using Omega warnings tend to get thrown for this. @see #2028045: fail row classes in views_view_grid for a similar issue.

wunderdog’s picture

Same issue here. Please help!!!

pippal’s picture

I had the same problem - using Omega 4 with drupal commerce and getting the above error when trying to view the shopping cart - the link to the issue above didn't help me so adding this for any one else that ends up in the same place.

The Views Megarow module in the latest drupal commerce is 1.0 but the latest version - 1.1 - has this commit http://drupalcode.org/project/views_megarow.git/commit/6573655

Updating Views Megarow to 1.1 fixed the problem.

janvonmulert’s picture

Issue summary: View changes

Just in case it may help someone I had similar error.

Using Omega 7.x-4.2 and Commerce 7.x-1.9

Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, string given, called in /var/www/.../sites/all/themes/..../templates/hack/views-view-table.tpl.php on line 41 and defined in drupal_attributes() (line 2376 of /var/www/.../includes/common.inc).

This error was coming from the shopping cart. A real bizzarre one too, worked fine on my dev server but error on prod. Gives me the creeps.

Fixed with adding is_array() check onle line 41 of /templates/hacks/views-view-table.tpl.php

      <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php  print drupal_attributes($field_attributes[$field][$row_count]);}?>>

To:

      <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php if ($field_classes[$field][$row_count] && is_array($field_classes[$field][$row_count])) { print drupal_attributes($field_attributes[$field][$row_count]);} ?>>
joelpittet’s picture

There are a few modules that seem to pass classes around as strings... This is very inconsistent, and I think even in core there is a bit of this because it's not enforced well...

<td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php  print drupal_attributes($field_attributes[$field][$row_count]);}?>>

Casting to an array may be much easier:

<td<?php if ($field_classes[$field][$row_count]) { print ' class="'. $field_classes[$field][$row_count] . '" '; } ?><?php  print drupal_attributes((array) $field_attributes[$field][$row_count]);}?>>

Also removed extra space and moved it into the print string.

paulbeaney’s picture

There is a related discussion about this in the Omega issue queue here https://www.drupal.org/node/2341767.

I have got round the problem by taking the views-view-table template from Megarow 1.4 (no longer present in 1.5) and putting it into the templates directory of our custom, Omega 4-based theme. I haven't properly analyzed the impact on the generation of the markup and CSS (if any), but the main thing is that it prevents error messages for now!