Change `getEntity` method visibility in Layout builder module

Created on 15 July 2021, over 3 years ago
Updated 3 February 2023, almost 2 years ago

Problem/Motivation

We would like to get programatically an entity object of block added in Layout Builder, but since `getEntity` method (/core/modules/layout_builder/src/Plugin/Block/InlineBlock.php:233) is protected, we can only get already rendered object, which doesn't fully cover our needs.

It would be great to make `getEntity` method public, so other developers could easily get added block objects if necessary.

Proposed resolution

Change `getEntity` method visibility from protected to public in `ExtraFieldBlock.php`, `FieldBlock.php` and `InlineBlock.php` files.

✨ Feature request
Status

Needs work

Version

9.5

Component
Layout builderΒ  β†’

Last updated 2 days ago

Created by

πŸ‡§πŸ‡ΎBelarus skorzh Belarus

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

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

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    From reading the comments seems as though there is still work/discussion to be add

    Did not review MR

    Whatever is decided will require test coverage.

Production build 0.71.5 2024