I'm getting the following error:

Notice: Undefined index: #cardinality in theme_field_collection_table_multiple_value_fields() (line 233 of C:\wamp\www\contracts2\sites\all\modules\field_collection_table\field_collection_table.module).

Comments

tim.plunkett’s picture

Um, wow. The theme function that is replacing makes the same assumptions about #cardinality being present. Can you provide more context, like what the url was, and what the settings were for the field collection and its items?

chalee’s picture

The error comes up only when I switch from edit mode to view mode of a node for anode type called 'organisation' which has a 'organisation_contacts' field_collection field embedded.

The field_collection field has the following settings:
Required field: NO
Number of values: unlimited
Widget type: hidden

The collection has: text, list and Term reference fields

I'm using automatic url aliasing. In edit mode the url is ?q=node/2/edit
When I switch to view mode url becomes ?q=content/organisation-name

cmmkelly’s picture

Hi,

I think I am getting the same error but under different circumstances, so I don't know if it might help in locating the issue...

I am using a file upload field in my field collection and when I have a browsed for the file and then clicked the Upload button, I get the error:

Notice: Undefined index: #title in theme_field_collection_table_multiple_value_field() (line 207 of C:\xampp\htdocs\lampchurch-drupal\sites\all\modules\field_collection_table\field_collection_table.module).

chalee’s picture

Further investigating my problem I found out that the error was showing only for field_collection fields which have the widget type set to 'hidden'.

To solve this I replaced the if statement on the problematic line of code as follows:

Before change:


if ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED) {

After the change:

$cardinality = isset($element['#cardinality'])? $element['#cardinality'] : FIELD_CARDINALITY_UNLIMITED;
if ($cardinality > 1 || $cardinality == FIELD_CARDINALITY_UNLIMITED) {
tim.plunkett’s picture

Title: Undefined index: #cardinality in theme_field_collection_table_multiple_value_fields() » Undefined index: #cardinality when using hidden widget
Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Assigned: Unassigned » tim.plunkett

Okay, now I know why I couldn't reproduce, I've only used the embedded widget.

tim.plunkett’s picture

Status: Active » Fixed

There might be a better fix, but adding an isset works well enough.
http://drupalcode.org/project/field_collection_table.git/commit/ac11831

Status: Fixed » Closed (fixed)

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

tim.plunkett’s picture

Also fixed http://drupal.org/node/1293710 in response to #3 on this issue.