Problem/Motivation

The module only looks for the start date in the primary entity of the view row, and doesn't support values in relationship entities. This can be seen on line 136 of src/FullcalendarViewPreprocess.php where it only looks for the field in $row->_entity but ignore all entities in the $row->_relationship_entities array.

My event content type uses a paragraph (but could use any entity reference) to store multiple calendar entries for the event. Think of an event with Day 1, Day 2, and Day 3; each with different hours and a sub-label.

Steps to reproduce

The cleanest way to recreate is to create an Event content type that has an entity reference field to a Calendar Entry entity (can just be another content type) that has a start and end date. Then a view of events with a reference to calendar entries. You can rewrite the title to "{{ title }}: {{ title_1 }}" to get a better feel of what to expect.

Event Node called "Drupal Con" that references Day 1, Day 2, and Day 3, each with a different time range.

Proposed resolution

It seems there may be another way to fetch the start date value that is doesn't involve the entity directly, but fetches it from the view row result. It also seems that it could be possible to check the entity and each relationship_entity for the fields.

Remaining tasks

I'll poke around to see if there is a clean way to expand this, but wanted to see if anyone else had any cleaver ideas.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jlashomb created an issue. See original summary.

mingsong’s picture

Category: Bug report » Feature request

This feature hasn't been implemented yet.

rj’s picture

This post came up while I was googling. A work around I implemented was to use the CER module and configure corresponding entity references from the relationship entity (eg. "Day 1", "Day 2") back to the primary entity (eg. "Event"). Then in the view I used date fields from the relationship entity and used contextual filters (ie. the primary entity NID) to filter the results to the specific primary entity. YMMV.

liber_t made their first commit to this issue’s fork.

liber_t’s picture

Assigned: Unassigned » liber_t

liber_t’s picture

Version: 5.0.5 » 5.x-dev
Status: Active » Needs review

I parse if start date and end date field exist in referenced entity.

Can you review my MR ?

Best regard,

DuaelFr made their first commit to this issue’s fork.

duaelfr’s picture

I discussed about this issue with @liber_t on Slack and we agreed that her approach had some flaws in the case where more than one relationship would have the same field.
I first tried to carry the relationship id with the field_name then realized the information was already available in the field options!
I updated the MR with a simple and functional fix for this issue.


Note for the maintainer: I beleive this issue also exist for some of the other fields like duration or rrule. You might want to open a follow up for those.
czigor’s picture

This is my go at it. We don't need to use foreach() since the view object contains the information on which relationship the field belongs to.

duaelfr’s picture

#10: beware! Different fields can use a different relationships. For example, a node carry the title when a Paragraph carry the date. By changing the current_entity you might create another issue. In the last version of the MR, we don't use a foreach anymore but we get the value for the appropriate relationship for each field.

w01f’s picture

Just making a note - I was able to get this to work on Drupal 9.3.3, Fullcalendar View 5.1.2 using a paragraph relationship with @DuaelFr's latest patch:
https://git.drupalcode.org/project/fullcalendar_view/-/merge_requests/20...

suparnaa.dey’s picture

Thanks @W01F #12 patch works for me as well on Drupal 9.3.3 and Fullcalendar View 5.1.2 using a paragraph relationship.

mingsong’s picture

Thanks everyone for working on this issue.
If we could get more people test on the PR, I am happy to merge it.

Good work.

w01f’s picture

Updating the latest FCV version breaks my calendars that were using the patch. The patch no longer applies, it looks because some start/end date code was added on line 136 of "src/FullcalendarViewPreprocess.php".

How does this new start/end date code work with DuaelFr's patch? Without the patch dates in a relationship entity no longer work again, despite the new code.

duaelfr’s picture

Assigned: liber_t » Unassigned

#15: I just push a reroll in the MR. Please try it and tell me if it works well.

w01f’s picture

Several of my calendars now work - with the exception of one for events, that is throwing this error in the log:

Warning: Trying to access array offset on value of type null in Drupal\fullcalendar_view\FullcalendarViewPreprocess->process() (line 138 of /var/www/harrisgrantconsulting.com/web/modules/contrib/fullcalendar_view/src/FullcalendarViewPreprocess.php)
#0 /var/www/harrisgrantconsulting.com/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 /var/www/harrisgrantconsulting.com/web/modules/contrib/fullcalendar_view/src/FullcalendarViewPreprocess.php(138): _drupal_error_handler()
#2 /var/www/harrisgrantconsulting.com/web/modules/contrib/fullcalendar_view/fullcalendar_view.theme.inc(32): Drupal\fullcalendar_view\FullcalendarViewPreprocess->process()
#3 /var/www/harrisgrantconsulting.com/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): template_preprocess_views_view_fullcalendar()
#4 /var/www/harrisgrantconsulting.com/web/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render()

Let me know if a view config export would help - I'm looking through it now and don't see anything really complicated.

w01f’s picture

Update - I now think this patch works perfectly for this issue and the one view I have not working is due to a different issue:

Filters not working with more than one filter group
https://www.drupal.org/project/fullcalendar_view/issues/3268182

So this looks to be good!

duaelfr’s picture

I pushed a commit to fix the warning.

mingsong’s picture

Status: Needs review » Closed (outdated)
kryber’s picture

Hello Mingsong, thanks for this nice module!

I am facing this issue in Drupal 11 with the latest code version. I am using paragraphs for dates since, in my case, multiple events can be included in a single node.

Is this issue really outdated?

kryber’s picture

Status: Closed (outdated) » Needs work
mingsong’s picture

Hi @kryber, you are welcome.

This module has been put into 'Maintenance fixes only' mode for a couple of years now. Which means it won't deliver any new feature requested.

I would suggest using other modules instead.

For example

https://www.drupal.org/project/fullcalendar

I close this feature request to prevent confusing to others.

mingsong’s picture

Status: Needs work » Closed (won't fix)