Fix fullcalendar_field_is_date() re: non-entity Views fields (e.g. 'Custom text')

Created on 8 October 2021, about 3 years ago
Updated 27 November 2024, 25 days ago

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().

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada bgilhome Victoria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore

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

  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore

    Updating the branch as its still present in latest DEV

  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore

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

  • Pipeline finished with Failed
    25 days ago
    Total: 157s
    #352097
  • Pipeline finished with Success
    25 days ago
    Total: 167s
    #352102
  • Pipeline finished with Success
    25 days ago
    Total: 159s
    #352113
  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore

    Tested the issue and is ready for merge.

  • πŸ‡ΊπŸ‡ΈUnited States erutan

    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). :)

  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore

    I think this fixes the issue mentioned and we can raise a feature ticket for Adding custom field for title. Let me create a ticket and link to this.

  • πŸ‡ΊπŸ‡ΈUnited States erutan

    Makes sense to me. :)

  • πŸ‡ΈπŸ‡¬Singapore anish.a Singapore
  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

    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

  • First commit to issue fork.
  • πŸ‡¨πŸ‡¦Canada mandclu

    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.

  • πŸ‡ΊπŸ‡ΈUnited States erutan

    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. :)

  • Pipeline finished with Skipped
    10 days ago
    #366184
  • πŸ‡¨πŸ‡¦Canada mandclu

    Great! Merged in

Production build 0.71.5 2024