Calendar Formatter and Search API

Created on 6 April 2023, about 1 year ago

Problem/Motivation

Hi, I'm trying to create a view based on a Search API index. I set the formatter to Calendar (Day) and added a contextual filter for one of the indexed Date fields. When I try to save the view, it gives this error:

\Drupal\calendar\Plugin\views\style\CalendarStyle: A calendar date argument is required when using the calendar style, to add a date argument in a view, please go to Advanced > Contextual Filters on the views configuration panel.

It seems the Calendar module expects a Date argument handler but it's getting a SearchApiDate argument handler instead which doesn't extend Date, resulting in the error.

I tried using hook_views_plugins_argument_alter to change the argument class for the search_api_date type to Drupal\views\Plugin\views\argument\Date instead of SearchApiDate, but that didn't work and gave this error instead:

Error: Call to undefined method Drupal\search_api\Plugin\views\query\SearchApiQuery::placeholder() in Drupal\views\Plugin\views\HandlerBase->placeholder() (line 508 of /var/www/drupal/web/core/modules/views/src/Plugin/views/HandlerBase.php)

Any insights on how to make the Calendar formatter work with the Search API dates is appreciated.

Thank you

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024