Undefined array key "base" in Drupal\views\Plugin\views\query\QueryPluginBase

Created on 9 April 2025, 10 days ago

Testing 0.2.1-alpha1

On a fresh Drupal 11.1.6 install

After enabling modules:
Experience Builder, Experience Builder dev mode, Experience Builder Test Node Article and xb_dev_standard, building UI.

When editing an article in XB, the components fail to load. And getting this error:

Warning: Undefined array key "base" in Drupal\views\Plugin\views\query\QueryPluginBase->getEntityTableInfo() (line 302 of core/modules/views/src/Plugin/views/query/QueryPluginBase.php).

πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡ΊπŸ‡ΈUnited States galactus86

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

Comments & Activities

  • Issue created by @galactus86
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    I could reproduce this.

    mkdir deleteme
    cd deleteme/
    ddev config --project-type=drupal11 --docroot=web
    ddev start
    ddev composer create drupal/recommended-project:^11
    ddev composer require drush/drush
    ddev composer require drupal/experience_builder:0.2.1-alpha1
    ddev drush site:install --account-name=admin --account-pass=admin -y
    ddev launch $(ddev drush uli)
    // Delete "article" content type and related config on the UI
    vim web/sites/default/settings.php
    // Write $settings['extension_discovery_scan_tests'] = TRUE;
    ddev drush en experience_builder xb_dev_mode xb_test_config_node_article --yes
    // Go to /xb/node/2/editor
    // Click on Dynamic components. It will show an error instead of the available blocks.
    

    After debugging, the issue is with the standard profile "Recent comments" view.
    There must be some incompatibilty with the XB Test Node Article config. Deleting/disabling that view fixes the issue.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    @lauriii Do we want to fix it, or just document it for early evaluators?

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Preemptively setting the Documentation component.

  • πŸ‡ΊπŸ‡ΈUnited States galactus86

    After deleting the view, now the components display and can be placed, but each time a component is placed I get a list of warnings.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    I'm very curious what the call stack is that ends up triggering this warning πŸ€ͺ

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    For the original error:

    Warning: Undefined array key "base" in Drupal\views\Plugin\views\query\QueryPluginBase->getEntityTableInfo() (line 302 of core/modules/views/src/Plugin/views/query/QueryPluginBase.php).
    Drupal\views\Plugin\views\query\QueryPluginBase->getEntityTableInfo() (Line: 1391)
    Drupal\views\Plugin\views\query\Sql->query() (Line: 1493)
    Drupal\views\Plugin\views\query\Sql->build() (Line: 1381)
    Drupal\views\ViewExecutable->build() (Line: 1451)
    Drupal\views\ViewExecutable->execute() (Line: 1514)
    Drupal\views\ViewExecutable->render() (Line: 133)
    Drupal\views\Plugin\views\display\Block->execute() (Line: 1690)
    Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
    Drupal\views\Element\View::preRenderViewElement() (Line: 61)
    Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 173)
    Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\BlockComponent->renderComponent() (Line: 306)
    Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\BlockComponent->getClientSideInfo() (Line: 220)
    Drupal\experience_builder\Entity\Component->normalizeForClientSide() (Line: 214)
    Drupal\experience_builder\Controller\ApiConfigControllers->Drupal\experience_builder\Controller\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 212)
    Drupal\experience_builder\Controller\ApiConfigControllers->Drupal\experience_builder\Controller\{closure}() (Line: 224)
    

    For the other error

    ViewsData.php:127, Drupal\views|ViewsData->get()
    QueryPluginBase.php:302, Drupal\views\Plugin|views|query|QueryPluginBase->getEntityTableInfo()
    Sql.php:1391, Drupal|views\Plugin|views|query|Sql->query()
    Sql.php:1493, Drupal\views\Plugin|views|query|Sql->build()
    ViewExecutable.php:1381, Drupal\views|ViewExecutable->build()
    ViewExecutable.php:1451, Drupal|views|ViewExecutable->execute()
    ViewExecutable.php:1514, Drupal\views| ViewExecutable->render()
    Block.php:133, Drupal\views\Plugin|views|display|Block->execute()
    ViewExecutable.php:1690, Drupal\views\ViewExecutable->executeDisplay()
    View.php:81, Drupal\ views|Element| View :: preRenderViewElement()
    ViewsBlock.php:61, Drupal\views|Plugin|Block|ViewsBlock->build()
    BlockComponent.php:173, Drupal\experience_builder\Plugin\ExperienceBuilder|ComponentSource\BlockComponent->renderComponent()
    BlockComponent.php:306, Drupal\experience_builder\Plugin\ExperienceBuilder|ComponentSource\BlockComponent->getClientSideInfo()
    Component.php:220, Drupal\experience_builder|Entity|Component->normalizeForClientSide()
    

    For the preprocess warnings:

    block_theme_suggestions_block()
    call_user_func_array() (Line: 355)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 307)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 354)
    Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 379)
    Drupal\Core\Theme\ThemeManager->buildThemeHookSuggestions() (Line: 220)
    Drupal\Core\Theme\ThemeManager->render() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 120)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 119)
    Drupal\Core\Render\Renderer->renderInIsolation() (Line: 52)
    Drupal\experience_builder\ClientSideRepresentation->renderPreviewIfAny() (Line: 214)
    Drupal\experience_builder\Controller\ApiConfigControllers->Drupal\experience_builder\Controller\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 212)
    Drupal\experience_builder\Controller\ApiConfigControllers->Drupal\experience_builder\Controller\{closure}() (Line: 224)
    Drupal\experience_builder\Controller\ApiConfigControllers->normalize() (Line: 89)
    
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    @penyaskito Thanks for all that detail in #7!

    But how is this possible if XB only allows block plugins that are fully validatable? Because the Views block one is not:

    views_block:
      type: block_settings
      label: 'View block'
      mapping:
        views_label:
          type: label
          label: 'Title'
        items_per_page:
          type: string
          label: 'Items per block'
    
    block.settings.views_block:*:
      type: views_block
    

    … another reason we really need πŸ“Œ Introduce unit test coverage for both ComponentSource plugins (Block + SDC) Active πŸ˜…

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Unassigning @lauriii because per #8, this really smells like a bug 😷

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί
    function experience_builder_config_schema_info_alter(array &$definitions): void {
      // This allows these blocks to be placed for now, but really the schema
      // should actually be FullyValidatable.
      // @todo Fix this in core or solve this another way in https://www.drupal.org/project/experience_builder/issues/3484666
      $types = ['block.settings.system_menu_block:*', 'block.settings.views_block:*'];
      foreach ($types as $type) {
        if (isset($definitions[$type])) {
          $definitions[$type]['constraints']['FullyValidatable'] = NULL;
        }
      }
    }
    

    πŸ“Œ Define `props` in the context of Block components Active was fixed, but we never did anything with this @todo. Is it time to remove this alter?

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    This doesn't looks like the right solution but avoids all the preprocess warnings:

    diff --git a/src/ClientSideRepresentation.php b/src/ClientSideRepresentation.php
    index 4637364..2f0d636 100644
    --- a/src/ClientSideRepresentation.php
    +++ b/src/ClientSideRepresentation.php
    @@ -49,6 +49,11 @@ final class ClientSideRepresentation implements RefinableCacheableDependencyInte
         }
    
         $build = $this->preview;
    +    // If it's a block, the preprocess won't have the necessary info and will
    +    // throw lots of warnings.
    +    if (isset($build['#theme']) && $build['#theme'] === 'block') {
    +      $build['#configuration'] += $build['#configuration']['default_settings'];
    +    }
         $default_markup = $renderer->renderInIsolation($build);
         $assets = AttachedAssets::createFromRenderArray($build);
         $import_map = ImportMapResponseAttachmentsProcessor::buildHtmlTagForAttachedImportMaps(BubbleableMetadata::createFromRenderArray($build)) ?? [];
    
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί
Production build 0.71.5 2024