Views with a different query plugin created via the UI do not have the correct query plugin ID in the view config

Created on 15 December 2016, about 8 years ago
Updated 23 January 2025, 12 days ago

Problem/Motivation

In πŸ’¬ Missing schema exception on latest 8.3.x when adding view via the UI Fixed , I tracked the issue down to this code in DisplayPluginBase::getPlugin():

    // Query plugins allow specifying a specific query class per base table.
    if ($type == 'query') {
      $views_data = Views::viewsData()->get($this->view->storage->get('base_table'));
      $name = isset($views_data['table']['base']['query_id']) ? $views_data['table']['base']['query_id'] : 'views_query';
    }
    else {
      $name = $options['type'];
    }

The problem here is that the query plugin is updated (in the linked issue, to search_api_query), but the actual view definition still contains the default query plugin ID of views_query.

Proposed resolution

Update the $options['type'] value to have the correct plugin ID.

Per #24, it appears to ignore the actual plugin in the views config, and switches out to the one defined in the views data array. Hence an upgrade path is not needed since it would not change anything that has an effect.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

Production build 0.71.5 2024