When calendar items are being rendered, the calendar only hides the first field type. This isn't an issue if there is only one instance of a field type.

When there are multiple instances of a field type, say a date fields where they are formatted differently and are hidden to be used in a conditional field, for example. Only the first date field will be hidden, and the second will be show even if it is marked to be hidden. Another example is if you have two image fields, and the first is set to be visible, and the second is set to be hidden, but the first will be hidden and the second will be shown.

The problem lies in how the template_preprocess_calendar_item function handles the render array. The core issue was that when going to unset a field, it was using the field's type not it's id. I changed the unset to use the field's id. In addition to this, I changed how the for loops where nested.

I have created a patch that fixes the issue by moving the rendered_fields for loop out of the views field loop. I then tested if a field was set to be hidden, and added that into an array. I then went through the render arrays looking for the fields that are suppose to be hidden. When a match is found that is suppose to be hidden, it is removed from the render array.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jazzfiction created an issue. See original summary.

jazzfiction’s picture

jazzfiction’s picture

Status: Active » Needs review
minorOffense’s picture

Status: Needs review » Needs work

There's a // var_dump($id); added in the patch. Should be removed.

jazzfiction’s picture

Status: Needs work » Needs review
FileSize
1.24 KB

The patch file without var_dump().