Problem/Motivation

When adding a non-entity Views field (e.g. "Custom text"), there is an ajax error:

"TypeError: Argument 1 passed to fullcalendar_field_is_date() must be an instance of Drupal\\views\\Plugin\\views\\field\\EntityField, instance of Drupal\\views\\Plugin\\views\\field\\Custom given".

Steps to reproduce

Add a view display using Fullcalendar style plugin, add a "Custom text" field.

Proposed resolution

Attached patch adds "\Drupal\views\Plugin\views\field\Custom" to allowed types of first argument of fullcalendar_field_is_date().

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

bgilhome created an issue. See original summary.

anish.a made their first commit to this issue’s fork.

anish.a’s picture

Version: 8.x-2.x-dev » 3.1.x-dev

Updating the branch as its still present in latest DEV

anish.a changed the visibility of the branch 3241489-fix-fullcalendarfieldisdate-re to hidden.

anish.a’s picture

Status: Needs review » Reviewed & tested by the community

Tested the issue and is ready for merge.

erutan’s picture

Status: Reviewed & tested by the community » Needs review

Thanks, this is a good thing to catch!

I got a white screen when adding a custom field without this patch when going to a view where a custom text field had been added, so it's more than an AJAX error.

While this does allow for a custom field to be added to a FullCalendar view without erroring out, the field cannot be used for the title. I'm not sure what other use case there is for one. Contents of a modal popup?

This technically solves the issue, but either a child issue should be created to address using a custom text field as the title or this should be changed to needs work. I haven't looked at the code at all.

FYI - it's not up to community norms to list your own work as RBTC, the idea behind it is that someone else confirms it works (hence the by the community part). :)

anish.a’s picture

I think this fixes the issue mentioned.

I had raised a separate feature ticket to handle the allowing custom fields as title - #3492780

erutan’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense to me. :)

anish.a’s picture

Issue tags: +Singapore2024
tim.plunkett’s picture

Assigned: Unassigned » mandclu
Priority: Normal » Major

This was broken by this commit, which was committed directly to the repo without a d.o issue.

I discussed this with @anish.a at DrupalCon, and while I suggested that he add test coverage, there are no tests in the module that I could find!

Bumping priority to major and assigning to @mandclu

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

mandclu’s picture

Assigned: mandclu » Unassigned
Status: Reviewed & tested by the community » Needs review

I don't think removing the type declaration is the right approach here. I've added a commit that adds it back, but adds Custom as an additional, accepted type. This also resolved the reported error in my testing, but please verify.

erutan’s picture

Status: Needs review » Reviewed & tested by the community

Tested the issue branch with mandclu's commit and custom fields can be added to the view without errors and the view renders fine in Drupal 10.3.

That does look like a better approach to scope it. :)

  • mandclu committed 92d5ad3d on 3.1.x authored by anish.a
    Issue #3241489 by anish.a, mandclu: Fix fullcalendar_field_is_date() re...
mandclu’s picture

Status: Reviewed & tested by the community » Fixed

Great! Merged in

Status: Fixed » Closed (fixed)

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