According to #670344: Make CCK compatible with both, views 2 and views 3 some updates are necessary for date to work with Views 3. Using date 2.4, it looks like some changes are needed. The changes should be compatible with Views 2.

Several modules like Content Profile, Date, Link, Flag are still using views_handler::options(&$options) {} to define options for this fields/filters/arguments.

This is not supported any more by views 3. We should use option_definition() ...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rjbrown99’s picture

In date_api_argument_handler.inc, change this:

  function options(&$options) {
    parent::options($options);
    $options['date_fields'] = array();
    $options['year_range'] = '-3:+3';
    $options['date_method'] = 'OR';
    $options['granularity'] = 'month';
  }

to this:

  function option_definition() {
    $options = parent::option_definition();
    $options['date_fields'] = array('default' => '');
    $options['year_range'] = array('default' => '-3:+3');
    $options['date_method'] = array('default' => 'OR');
    $options['granularity'] = array('default' => 'month');

    return $options; 
  }

Also, in date_api_filter_handler.inc, remove this:

  function options(&$options) {
    parent::options($options);
    $options['date_fields'] = array();
    $options['date_method'] = 'OR';
    $options['granularity'] = 'day';
    $options['form_type'] = 'date_select';
    $options['default_date'] = '';
    $options['default_to_date'] = '';
    $options['year_range'] = '-3:+3';
  }

and change the options_definition to this:

  function option_definition() {
    $options = parent::option_definition();
    $options['date_fields'] = array('default' => '');
    $options['date_method'] = array('default' => 'OR');
    $options['granularity'] = array('default' => 'day');
    $options['form_type'] = array('default' => 'date_select');
    $options['default_date'] = array('default' => '');
    $options['default_to_date'] = array('default' => '');
    $options['year_range'] = array('default' => '-3:+3');

    return $options;
  }

Last but not least, date_plugin_display_attachment.inc needs to be changed. This is the code block that needs updating, but I'm not sure as to how to do this one given the arguments being passed around.

  function options(&$display) {
    parent::options($display);
    $display->display_options['style_plugin'] = 'date_nav';
    $display->display_options['items_per_page'] = 0;
    $display->display_options['row_plugin'] = '';
    //$display->display_options['defaults']['style_plugin'] = FALSE;
    $display->display_options['defaults']['style_options'] = FALSE;
    $display->display_options['defaults']['items_per_page'] = FALSE;
    $display->display_options['defaults']['row_plugin'] = FALSE;
    $display->display_options['defaults']['row_options'] = FALSE;
  }
Ahqar’s picture

@ rjbrown99

Changing the last bit to the following did the trick for me.

function options($display) {
  $display['display_options']['style_plugin'] = 'date_nav';
  $display['display_options']['items_per_page'] = 0;
  $display['display_options']['row_plugin'] = '';
  //$display['display_options']['defaults']['style_plugin'] = FALSE;
  $display['display_options']['defaults']['style_options'] = FALSE;
  $display['display_options']['defaults']['items_per_page'] = FALSE;
  $display['display_options']['defaults']['row_plugin'] = FALSE;
  $display['display_options']['defaults']['row_options'] = FALSE;
}
tauno’s picture

Status: Active » Needs review
FileSize
4.4 KB

Patch based on #1 and an attempt at updating date_plugin_display_attachment.inc based on the views display plugin. The attachment display has not been tested yet.

dagmar’s picture

Status: Needs review » Needs work
FileSize
1.33 KB
-  function options(&$options) {
-    parent::options($options);
+  function option_definition() {
+    $options = parent::option_definition();
     $options['repeat'] = array(
       'show_repeat_rule' => '',
       );
     $options['multiple']['multiple_to'] = ''; 
     $options['fromto']['fromto'] = 'both'; 
+    return $options;

It seems that this is not correctly converted. Please take a look to the attached patch. Views uses 'contains' for complex arrays.

My patch doesn't include the conversion for date_plugin_display_attachment so, if you can take care of merge both patches, I will appreciate. Thanks!

tauno’s picture

Status: Needs work » Needs review
FileSize
4.78 KB

Incorporating changes from #4.

AdrianB’s picture

Subscribing.

perusio’s picture

Thanks for the patch it fixes the issues, although there are two spurious '\ No newline at end of file' lines in the patch. Here's a new one with the said lines removed.

KarenS’s picture

Status: Needs review » Fixed

Finally got to this. I ended up applying it by hand but I believe it is correct. Please let me know if it is not.

Thanks everyone!.

tim.plunkett’s picture

According to the commit log, this also made changes in date/date.module that now try to call theme_date_all_day() by passing an array instead of 6 variables, but date/date.theme still expects 6 variables.

diff of date.module

Missing argument 3 for theme_date_all_day() in /sites/all/modules/date/date/date.theme on line 248

KarenS’s picture

Crap, I committed some D7 changes to D6. I'll fix it.

choster’s picture

Thanks, hopefully that will also clear up #733986: Missing argument x for theme_date_all_day().

tim.plunkett’s picture

Status: Fixed » Active

marked as active as a reminder

Dig1’s picture

Yep, I am running Drupal 6.16 and I just upgraded the Date module to 2010-Mar-06 and got:

Missing argument x for theme_date_all_day()

in multiple lines all over the front page.

So I re-used 2009-Nov-11 and the problem goes away.

Cheers

H3x’s picture

+1

jcmarco’s picture

Status: Active » Needs review
FileSize
1.06 KB

In the function date_formatter_process($element), the theme function is called with D7 format, using arrays to pass arguments.
If you don't want to break API compatibility then the theme and arguments should be the same, in other case the theme function
should be declared using an arrays as argument. There is even a new argument not declared in the theme function.
But I guess that the real problem is using the D7 theme() format.

anawillem’s picture

i applied the above patches, and now the list of errors only happens when I am actually looking at a calendar view (it was happening on every page). any ideas?

anawillem’s picture

subscribing

KarenS’s picture

Status: Needs review » Fixed

Fixed, sorry about that!

Status: Fixed » Closed (fixed)

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

timlie’s picture

What about the new "group filters" of views 3 (AND - OR)?
With date you can specify if date filters use AND ; OR.

As views 3 has this ability of his own it can be removed. As far as I have tested it now it doesn't even work anymore in conjunction with group filters in views 3.

kevinob11’s picture

Status: Closed (fixed) » Needs work

Any idea of the issue mentioned in #20 is going to be resolved? I've run into this as well, as date creates its own group and messes up the grouping that is now built into views.

emosbaugh’s picture

subscribing

macdonaldj’s picture

not sure if this issue is related, but with views 3 and filtering by date with all filters in the same group, it uses an OR instead of an AND with the date:

the where clause:

WHERE ((node.status = 1) AND (node.type in ('events')) AND ((node_data_field_tap_talk.field_tap_talk_value) = ('1'))) OR (DATE_FORMAT(node_data_field_date.field_date_value, '%Y-%m-%d') >= '2011-10-12')

I would expect the statement to be:

WHERE ((node.status = 1) AND (node.type in ('events')) AND ((node_data_field_tap_talk.field_tap_talk_value) = ('1')) AND (DATE_FORMAT(node_data_field_date.field_date_value, '%Y-%m-%d') >= '2011-10-12'))

kevinob11’s picture

I think it is related. It appears that date is using its own built in grouping instead of using the grouping built into views 3. I've built a small module that moves them back into the appropriate group, however its pretty hacky since it uses a ton of nested if statements in order to account for all (probably only most) permutations of date where clauses. I haven't had time to dig into date and see if I can write a patch, I will try to find some time in the next few weeks.

@macdonaldj if all of your other stuff is in a single group you might be able to fix your issue by just switching the date specific functionality to "and" instead of "or", its at the bottom of the page when you add a date filter.

idflood’s picture

Here is an issue related to what is described in #23 I think: #735170: Date filter incorrectly grouped in Views 3 filter

DamienMcKenna’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Unfortunately the D6 version of this module is no longer supported, but we appreciate the time you put into this.