In that function view's field object cloned:
$field_names[$field_name] = array('options' => $group, 'delta_field' => $delta_field, 'view_field' => drupal_clone($field));

Then take a look into class date_handler_field_multiple in render() method.
Results of date_handler_fields() call writed to field property:
$values->date_info->date_handler_fields = date_handler_fields($this->view);

As a result we have cycle reference to view object (view have field, which referenced to same view object), and it brakes some behavior.
In my case VBO view are broken if i add field from date module to view display.

I didn't find usage of 'view_field' property. Is it usefull?

CommentFileSizeAuthor
#1 vbo-broken-1671500-1.patch3.04 KBkevin.dutra
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kevin.dutra’s picture

Title: Reason of 'view_field' property in date_handler_fields(). » Date field breaks Views Bulk Operations
Status: Active » Needs review
FileSize
3.04 KB

I'm finding the same thing--when you include a field in a VBO view that uses the date_handler_field_multiple handler, it breaks the VBO functionality. From what I can see, this is because the render function modifies the $values parameter. This probably only happens with PHP5 when the object model changed a bit.

I don't think this was the intention, nor does it seem like desired behavior. Attached is a patch that clones $values so that it doesn't get altered.

pkiff’s picture

Thanks for this patch. I had a similar issue with Date 6.x-2.9 running Views 3.x and Views Bulk Operations 6.x-1.13. The problem was most evident with views using exposed Date filters, because I could not properly use the select all box in those cases (it would be selected already, but no corresponding rows would be selected, and the display of the number selected was always 0).

The patch in #1 (applied manually to 6.x-2.9) fixed the issue and allowed proper selection of rows, including selecting all on one or more pages.

pkiff’s picture

Following up on my own post here. It appears that there is a patch for Views Bulk Operations 6.x-1.13 that addresses this here:
Date field handler messes up selection

Also, it appears that the 6.x-1.x-dev version of Views Bulk Operations has a different fix that looks to address the same problem for Drupal 6.x installs.

I'm not sure which version of VBO the original poster was running, but if, like me, they were running VBO 6.x-1.13, then it may be that rather than patching the Date module, it may be better to apply the patch I've indicated to View Bulk Operations, or to try updating that module to the dev version.

kevin.dutra’s picture

Yeah, I had thought about applying a patch to VBO to work around it. In the end I decided that patching Date was a better way to go only because altering the $values param when rendering a Views field feels like bad practice, even if it didn't impact VBO.

AaronBauman’s picture

Issue summary: View changes
Status: Needs review » Needs work

This is a patch for Date module, but it's in the VBO queue.

Is there no way to patch VBO module to fix this issue?
That would be the preferable solution.

If there's no way to fix this in VBO, this issue should be moved to Date queue.

AaronBauman’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Sorry, I'm an idiot.
This is in the Date queue already.

This issue does persist to 7.x, so still needs work.