Problem/Motivation
When opening any view to edit I receive an console error and the warning is this:
( ! ) Warning: Undefined array key "title" in /var/www/html/web/modules/contrib/jsonapi_views/jsonapi_views.module on line 43
Call Stack
# Time Memory Function Location
1 0.0337 519656 {main}( ) .../index.php:0
2 0.1888 680408 Drupal\Core\DrupalKernel->handle( $request = class Symfony\Component\HttpFoundation\Request { public $attributes = class Symfony\Component\HttpFoundation\ParameterBag { protected $parameters = [...] }; public $request = class Symfony\Component\HttpFoundation\InputBag { protected $parameters = [...] }; public $query = class Symfony\Component\HttpFoundation\InputBag { protected $parameters = [...] }; public $server = class Symfony\Component\HttpFoundation\ServerBag { protected $parameters = [...] }; public $files = class Symfony\Component\HttpFoundation\FileBag { protected $parameters = [...] }; public $cookies = class Symfony\Component\HttpFoundation\InputBag { protected $parameters = [...] }; public $headers = class Symfony\Component\HttpFoundation\HeaderBag { protected $headers = [...]; protected $cacheControl = [...] }; protected $content = NULL; protected $languages = NULL; protected $charsets = NULL; protected $encodings = NULL; protected $acceptableContentTypes = NULL; protected $pathInfo = '/admin/structure/views/view/content/preview/page_1'; protected $requestUri = '/admin/structure/views/view/content/preview/page_1?_wrapper_format=drupal_ajax'; protected $baseUrl = ''; protected $basePath = ''; protected $method = 'POST'; protected $format = 'html'; protected $session = class Symfony\Component\HttpFoundation\Session\Session { protected $storage = class Drupal\Core\Session\SessionManager { ... }; private string $flashName = 'flashes'; private string $attributeName = 'attributes'; private array $data = [...]; private int $usageIndex = 6; private ?Closure $usageReporter = NULL }; protected $locale = NULL; protected $defaultLocale = 'en'; private ?string $preferredFormat = NULL; private bool $isHostValid = TRUE; private bool $isForwardedValid = TRUE; private bool $isSafeContentPreferred = *uninitialized*; private array $trustedValuesCache = []; private $isIisRewrite = FALSE }, $type = ???, $catch = ??? )
Current module version: 1.1
Drupal core: 10.5.1
This the block of code where the error occurs:
// Build Exposed filter queries.
$display_handler = $executable->getDisplay();
foreach ($display_handler->view->filter as $filter) {
if ($filter->isExposed() && $input[$filter->field]) {
$query["views-filter[{$filter->field}]"] = $input[$filter->field];
}
}
My suggestion is to add an check in the $input[$filter->field]
// Build Exposed filter queries.
$display_handler = $executable->getDisplay();
foreach ($display_handler->view->filter as $filter) {
if ($filter->isExposed() && isset($input[$filter->field]) && $input[$filter->field]) {
$query["views-filter[{$filter->field}]"] = $input[$filter->field];
}
}
I will post a patch for it.
Comments
Comment #2
aluzzardiHere is patch to fix the issue.
Comment #3
aluzzardi