Hey ppl! First of I want -of course- to thank all of you who helped build this incredible module, and also I apologize if this is any kind of duplicate.

Alright, I've been trying to use a custom date field within a view for more than a week now, and I think that I've found a correct way to do it.

first of, this is what my field looks like (within my module):

$my_table["date_field"] = array(
      'group' => $my_view_info['group'],
      'title' => t(' a date. '),
      'title short' => t(' date. '),
      'help' => t(' date. '),
      'field' => array(
        'field_name' => 'a date',
        'type' => 'datetime',
        'tz_handling' => 'none',
        'table' => 'my_table',
        'handler' => 'my_handler',
      ),
      'argument' => array(
        'table' => 'my_table',
        'handler' => 'views_handler_argument_date',
      ),
      'filter' => array(
        'table' => 'my_table',
        'handler' => 'views_handler_filter_date',
      ),
    );

What happens is that as you can see, I declare my own timezone and date type within this declaration, but the Field module does not support my field, since it wasn't declared within the normal mechanics of Drupal.

I noticed that in date_views/includes/date_views_fields.inc, some assumptions were made concerning that last fact:

// For Field module fields, get the date type.

[some code]

I made a patch that adds some conditions to this file, so that the handler is questionned if the Field module is not answering.

Tell me what you think, is this a good approach? Is there something missing?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Marc-Antoine’s picture

Issue summary: View changes

Changed a bit my code to be more precise

webci274’s picture

date_views_m-a.patch queued for re-testing.

Marc-Antoine’s picture

FileSize
2.72 KB

here's another version of the patch, it prevents date_views from checking the database if no record exists, and instead uses the field's alias as the entry.

Status: Needs review » Needs work

The last submitted patch, date_views_m-a3.patch, failed testing.

Marc-Antoine’s picture

Status: Needs work » Needs review

#2: date_views_m-a3.patch queued for re-testing.

Marc-Antoine’s picture

Status: Needs work » Needs review

I've been able to apply my patch without any problem, I don't get why the system displays an error

can someone help me understand?

Status: Needs review » Needs work

The last submitted patch, date_views_m-a3.patch, failed testing.

Marc-Antoine’s picture

FileSize
2.71 KB

here comes the same patch without the bug, I carelessly deleted a line..

Marc-Antoine’s picture

Issue summary: View changes

Added some bold

podarok’s picture

Issue summary: View changes
podarok’s picture

7: 1485794-7_date_views.patch queued for re-testing.

DamienMcKenna’s picture

Assigned: Marc-Antoine » Unassigned

Reminder: the "assigned" field is for indicating that you are actively working on something, it is not for indicating that you reported a problem or that you previously worked on a problem and would like attribution. Thanks.