Module looks great, albeit fatal error is raised when trying to edit a node to which Properties widget is attached.

Fatal error: Unsupported operand types in mysite.com/sites/all/modules/properties/properties_template/properties_template.module on line 227

For test I created one category with 4 attributes. All are displayed when creating node. I filled values of 2 attributes, and only one is displayed in the table attached.
-----

When I tried to edit nodes created BEFORE creating categories and attributes similar error is raised:

Fatal error: Unsupported operand types in mysite.com/sites/all/modules/properties/properties_template/properties_template.module on line 207

Comments

rruppel’s picture

I had the same issue.

I did some investigation and figured out the problem:

Its in the function properties_template_field_attach_form in line 158 of properties_template.module.

The problem is that the variable $langcode received by the function is the language of the node.

While the variable $form[$field_name] is filled with the language of the fields.

What happens is that on line 228 we try to add an action to the $form[$field_name]:

$form[$field_name][$langcode]['actions'] += $element;

But not always the $langcode available in the $form[$field_name] array will be the same as the node language.

What I did to fix, just check if the $langcode key is present in the array (line 167) to get the default language (before it would only check if $langcode was empty)

if (empty($langcode) || !array_key_exists($langcode, $form[$field_name])) {

I am not sure if this is a bug of drupal core or this would be the right way to do it. But it seems logical to me.

Regards,

inventlogic’s picture

I got this error on the latest dev version 2012-Oct-24 so this has not been fixed yet.

I applied the above fix in #1 and error went away.

Will this be committed soon?