getBlockTypeByUuid does not filter reusable blocks

Created on 17 January 2024, 6 months ago

Problem/Motivation

https://git.drupalcode.org/project/layout_builder_restrictions_by_role/-...

private function getBlockTypeByUuid() {
    if ($this->moduleHandler->moduleExists('block_content')) {
      // Pre-load all reusable blocks by UUID to retrieve block type.
      $query = $this->database->select('block_content', 'b')
        ->fields('b', ['uuid', 'type']);
      $results = $query->execute();
      return $results->fetchAllKeyed(0, 1);
    }
    return [];
  }

The comments says that it is filtering on reusable blocks while it it currently not the case.

This should improve performance also in correlation with #3322896: Cache getBlockTypeByUuid β†’ .

Proposed resolution

Add a merge on the block_content_field_data table to avoid the entity query.

Remaining tasks

Agree on solution
Implements agreed solution

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

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

Comments & Activities

Production build 0.69.0 2024