Integration with Search API

Created on 21 October 2019, about 5 years ago
Updated 11 September 2024, 3 months ago

Trying to add a page or other display to a view using a Search API index of nodes with the format set to "Full Calendar Display" results in:

Error: Call to a member function id() on boolean in Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay->buildOptionsForm() (line 138 of ...fullcalendar_view/src/Plugin/views/style/FullCalendarDisplay.php)

If the $entity_type is instead set manually to 'node' at line 138. Then we get another error:

Error: Call to a member function hasField() on null in template_preprocess_views_view_fullcalendar() (line 154 of ...fullcalendar_view/fullcalendar_view.theme.inc)

Again, if we set this variable instead to $row->_item->getOriginalObject()->getEntity() then the format settings can be edited and the view displays properly. Seems like this would work okay for the second error, but I don't know how to get the entity type of the base table of the view. And probably there are other potential problems here?

Feature request
Status

Closed: won't fix

Version

5.0

Component

Code

Created by

🇺🇸United States beunerd Providence, Rhode Island

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

Comments & Activities

Not all content is available!

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

  • 🇦🇺Australia mingsong 🇦🇺
  • 🇺🇦Ukraine sickness29

    This is reroll of patch 18 to those who also want to load only items in display.

    Tested for version 5.1.8
    First apply patch from https://www.drupal.org/project/fullcalendar_view/issues/2960335#comment-... Loading items as needed by AJAX Closed: outdated .
    Then apply this patch.

    Now toy have setting Date Field for Filtering where you are able to select filter on a view that supposed to be between date filter.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India arunkumark Coimbatore

    I can able to reproduce the issue on the Drupal 10.x core version. Rerolled the patch to work with all the 5.x versions.

  • 🇺🇦Ukraine sickness29

    This is changed version of patch from #27.
    Fixes issue with no results when skip_access option enabled for search api calendar view.
    In that case _entity property is not set, but there's an entity adapter that allows to still fetch entity if needed.
    Tested on 5.1.8

  • 🇺🇸United States Kasey_MK

    I couldn't get #30 to apply to 5.1.13 so here's a version that does. (I skipped all the whitespace fixes in fullcalendar_view.js because that seems like a separate issue to me; there's no other reason to touch that file in response to this issue that I can see.)

    BTW, after installing this patch and moving my fullcalendar_view views to work on search_api and search_api_solr, I started seeing the errors mentioned in Undefined array key : views_view_fullcalendar 🐛 Undefined array key : views_view_fullcalendar Closed: outdated . I don't know if it's related, but this change in src/FullcalendarViewPreprocess.php (not included in patch #31 here) seems to allow my Solr-based fullcalendar views to work without warning messages:

    -$des[$idkey] = $field->advancedRender($row);
    +if (array_key_exists($idkey, $des)) {
    + $des[$idkey] = $field->advancedRender($row);
    +}

  • 🇺🇸United States Kasey_MK

    Gah nevermind that code snippet in #31; it did make the warnings go away but it also messed up the view row data.

  • 🇺🇸United States Kasey_MK

    What ended up making those Undefined array key : views_view_fullcalendar 🐛 Undefined array key : views_view_fullcalendar Closed: outdated errors go away for me was not using the search_api_solr-based fullcalendar_view to render a multi-value field's first value only. Instead, I used a custom field formatter and a custom node view mode to render only the first value of the field in question, adding that to my search index as storage-only rendered HTML, and including that in my view instead of the multi-value field.

  • 🇪🇸Spain programeta

    I've tested #31 with a clean Drupal 10.2 and works for me.

    Thanks!

  • 🇺🇸United States dealancer Washington D.C.

    So when patch 31 is applied the problem happens when you edit view and click Settings. No settings form is shown but I can see a following error message in logs.

    This is true for regular Drupal content index (not Search API).

    Error: Object of class Drupal\Core\Entity\ContentEntityType could not be converted to string in Drupal\field\Entity\FieldStorageConfig::loadByName() (line 807 of /code/web/core/modules/field/src/Entity/FieldStorageConfig.php)
    #0 /code/web/modules/contrib/fullcalendar_view/src/Plugin/views/style/FullCalendarDisplay.php(526): Drupal\field\Entity\FieldStorageConfig::loadByName(Object(Drupal\Core\Entity\ContentEntityType), 'title')
    #1 /code/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(1685): Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
    #2 /code/web/core/modules/views/src/Plugin/views/display/PathPluginBase.php(437): Drupal\views\Plugin\views\display\DisplayPluginBase->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
    #3 /code/web/core/modules/views/src/Plugin/views/display/Page.php(257): Drupal\views\Plugin\views\display\PathPluginBase->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
    #4 /code/web/core/modules/views_ui/src/Form/Ajax/Display.php(74): Drupal\views\Plugin\views\display\Page->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
    #5 [internal function]: Drupal\views_ui\Form\Ajax\Display->buildForm(Array, Object(Drupal\Core\Form\FormState))
    #6 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array(Array, Array)
    #7 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm('views_ui_edit_d...', Object(Drupal\Core\Form\FormState))
    #8 /code/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(215): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
    #9 /code/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}()
    #10 /code/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(217): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #11 /code/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(127): Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
    #12 /code/web/core/modules/views_ui/src/Form/Ajax/Display.php(46): Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object(Drupal\views_ui\ViewUI), 'page_1', 'ajax')
    #13 [internal function]: Drupal\views_ui\Form\Ajax\Display->getForm(Object(Drupal\views_ui\ViewUI), 'page_1', 'ajax', 'style_options')
    #14 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #15 /code/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #16 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #17 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #18 /code/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #19 /code/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #20 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #26 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #27 /code/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #28 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #29 {main}
    
  • Status changed to Closed: won't fix 4 months ago
  • 🇦🇺Australia mingsong 🇦🇺

    There is further plan for the feature with this module.

    Here are some alternative to those who interested in this feature.

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

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

  • 🇺🇸United States Kasey_MK

    I haven't investigated the proposed alternate solutions yet, but here's a re-roll of 31 in the meantime.

Production build 0.71.5 2024