Problem/Motivation

HEAD runs a config entity query on block entities and then it filters the results. All this is hardwired into the FullPageVariant. More efficient storages would need to replace FullPageVariant.

Proposed resolution

Provide a standalone service to find visible block entities.

Remaining tasks

User interface changes

API changes

API addition of \Drupal\block\BlockRepository

Comments

dawehner’s picture

Extracting that logic out into a separate service is a good idea in general. Whether the block storage is the right place is not clear for me.

tim.plunkett’s picture

StatusFileSize
new20.67 KB
new8.69 KB

I am also not 100% sure this should be on storage, but it might be okay. For now, just tweaking some things and fixing the tests.

fabianx’s picture

I think this is a good abstraction, RTBC + 1 from me.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
StatusFileSize
new20.83 KB
new14.99 KB

This feels much cleaner to me. We have a simple service that combines storage and access in a specific and needed method. It can be swapped out independently of the storage, and is actually then easier to test.

fabianx’s picture

RTBC!!! - Very nice idea!

Does this still need further tests as stated in issue summary or is this ready?

tim.plunkett’s picture

Issue summary: View changes

Yes, it has tests now, and the old ones are restored.
I'd considering this RTBC, and I ran it by @EclipseGc

tim.plunkett’s picture

Issue summary: View changes
fabianx’s picture

Status: Needs review » Reviewed & tested by the community

RTBC then

tim.plunkett’s picture

StatusFileSize
new19.97 KB
new4.5 KB

@dawehner pointed out that theme negotiator is being misused here.

fabianx’s picture

Still RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 2367579-blocks-8.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new20.22 KB
new1.72 KB

Oh, that returns an object instead of a string.

tim.plunkett’s picture

Title: Make it possible to speed up blocks » Move retrieval of visible blocks to a standalone service
Status: Needs review » Reviewed & tested by the community

#10 covered the intent of my change, I just did it wrong, so setting back to RTBC.

fabianx’s picture

Agree with RTBC

alexpott’s picture

Category: Task » Bug report

Reclassifying this as a bug since having the FullPageVariant directly accessing block and checking access is the presentation layer reaching through the business logic layer and directly into the storage layer. This is a bad idea and as the issue summary points out more efficient storages would have to replace the FullPageVariant.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Also this change makes life easier for contrib and to improve the performance of loading blocks per region. Committed ec7b056 and pushed to 8.0.x. Thanks!

  • alexpott committed ec7b056 on 8.0.x
    Issue #2367579 by tim.plunkett, chx: Fixed Move retrieval of visible...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.