Currently, there are problems creating calendars with entities that use date fields. The issues stem from confusion around the base table and bundle.

This patch fixes those issues and also reverses a commit which blocked a number of date fields from appearing on the Add view from template. It also addresses four other issues that are outstanding on the list.

Please review and consider applying this patch. it should put a smile on a lot of peoples faces.

Regards,

Alex

Comments

alex.neblett’s picture

Status: Active » Needs review
johnv’s picture

FYI, this is a follow-up from #1451512-4: Calendar from Date Field

johnv’s picture

Hi Alex, can yo be more specific about "four other issues that are outstanding on the list".
Do you refer to Calendar issue-queue issues?

johnv’s picture

Title: Cannot create View (from template) for Entities with Fields using Fields API » Fix for Entities with Fields using Fields API

I have tested your patch. (for page admin/structure/views/add-template)
I have a field field_date_open_from_to, and it is used in both nodes and taxonomy terms.

Without patch: A calendar view of the field in the 'node' base table.
With patch: A calendar view of the field in the 'taxonomy_term_data' base table.

I would expect both lines in the list.
The following code (changing views name and path) works fine:

            if ($field['module'] == 'date') {
              $base_table = $info['base table'];
              $calendar_option = array(
                'name' => 'calendar_' . $base_table . '_' . $field_name,
                'description' => t("A calendar view of the '@field_name' field in the '@base_table' base table.", array('@base_table' => $base_table, '@field_name' => $field_name)),
                'path' => str_replace('_', '-', 'calendar-' . $base_table . '-' . $field_name),
                'base_table' => $base_table,
                'field_name' => $field_name,
              );

(Sorry for not providing a patch.)

johnv’s picture

Title: Fix for Entities with Fields using Fields API » Cannot create View (from template) for Entities with Fields using Fields API
Status: Needs review » Needs work

Better title, since it mostly addresses calendar_views_templates () function.

I wondered why the patch contains code for calendar_plugin_row.inc .
If not, the view for e.g. taxonomomy terms will show nothing.

karens’s picture

Title: Fix for Entities with Fields using Fields API » Cannot create View (from template) for Entities with Fields using Fields API
Status: Needs work » Postponed (maintainer needs more info)

The only explanation for this patch is "there are problems creating calendars with entities that use date fields". That is too vague to be useful. I don't have any problems. I need steps to reproduce the problems before we start talking about changing the code.

karens’s picture

Status: Postponed (maintainer needs more info) » Fixed

Working through #4 and #5 gave me enough information to figure out what the purpose of this patch is. That's the kind of information that makes it possible for me to evaluate these proposed changes.

I tried the test scenario described in #4 and can see that I'm not getting both fields to show up. I also can see that a different one shows up with the patch but still not both of them. I made the additional changes described in #4 and now I can see both fields.

The last thing was to test the original problem of making sure that a field used on two different content types does not show up twice in the list, and that also seems to be OK.

Thanks!

http://drupalcode.org/project/calendar.git/commit/9e41beb

johnv’s picture

:-)

Status: Fixed » Closed (fixed)

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