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?
Comment | File | Size | Author |
---|---|---|---|
#7 | 1485794-7_date_views.patch | 2.71 KB | Marc-Antoine |
Comments
Comment #0.0
Marc-Antoine CreditAttribution: Marc-Antoine commentedChanged a bit my code to be more precise
Comment #1
webci274 CreditAttribution: webci274 commenteddate_views_m-a.patch queued for re-testing.
Comment #2
Marc-Antoine CreditAttribution: Marc-Antoine commentedhere'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.
Comment #4
Marc-Antoine CreditAttribution: Marc-Antoine commented#2: date_views_m-a3.patch queued for re-testing.
Comment #5
Marc-Antoine CreditAttribution: Marc-Antoine commentedI'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?
Comment #7
Marc-Antoine CreditAttribution: Marc-Antoine commentedhere comes the same patch without the bug, I carelessly deleted a line..
Comment #7.0
Marc-Antoine CreditAttribution: Marc-Antoine commentedAdded some bold
Comment #8
podarokComment #9
podarok7: 1485794-7_date_views.patch queued for re-testing.
Comment #10
DamienMcKennaReminder: 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.