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().
| Comment | File | Size | Author |
|---|
Issue fork fullcalendar-3241489
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
Comment #3
anish.a commentedUpdating the branch as its still present in latest DEV
Comment #6
anish.a commentedTested the issue and is ready for merge.
Comment #7
erutan commentedThanks, 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). :)
Comment #8
anish.a commentedI think this fixes the issue mentioned.
I had raised a separate feature ticket to handle the allowing custom fields as title - #3492780
Comment #9
erutan commentedMakes sense to me. :)
Comment #10
anish.a commentedComment #11
tim.plunkettThis 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
Comment #13
mandclu commentedI 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.
Comment #14
erutan commentedTested 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. :)
Comment #16
mandclu commentedGreat! Merged in