Error: Call to a member function getValue() on null in Drupal\views\Plugin\views\style\StylePluginBase->getFieldValue() (line 805 of core/modules/views/src/Plugin/views/style/StylePluginBase.php).

Created on 20 February 2025, 5 days ago

Problem/Motivation

When sorting entity fields with long text I get WSOD.

Steps to reproduce

  1. Create custom module drush gen module
  2. Create custom content entity (TestContent) drush gen entity:content Make sure to add "description" base field
  3. Enable custom module and views_aggregator
  4. Create view for custom content entity (TestContent) with "Table with aggregation options". Include Description field
  5. Enable sorting of Description field
  6. Save view
  7. Visit view and click sorting of Description
  8. WSOD

The website encountered an unexpected error. Try again later.

Error: Call to a member function getValue() on null in Drupal\views\Plugin\views\style\StylePluginBase->getFieldValue() (line 805 of core/modules/views/src/Plugin/views/style/StylePluginBase.php).
Drupal\views_aggregator\Plugin\views\style\Table->compareResultRows()
uasort() (Line: 434)
Drupal\views_aggregator\Plugin\views\style\Table->preRender() (Line: 1568)
Drupal\views\ViewExecutable->render() (Line: 201)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1690)
Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
Drupal\views\Element\View::preRenderViewElement()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Update code to use correct field. Right now it tries to use entity_field that is not correct.

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden kristofferwiklund

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024