Add block type to description

Created on 5 March 2021, almost 4 years ago
Updated 22 August 2024, 4 months ago

Problem/Motivation

If you disable "Show content preview" when editing a layout it can be hard to tell which block is which.

Proposed resolution

Add the block type to the generated label.

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡¦πŸ‡ΊAustralia fenstrat Australia

    This makes sense as an addition.

    However rather than looking into the $form for the admin_label we should be able to load the block with something like $block = $form_state->getFormObject()->getEntity() and then use $block->getPlugin()->getPluginDefinition()['admin_label'] instead. Would be nice to add a quick test for this as well.

  • πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ

    $form_state->getFormObject() is an instance of Drupal\layout_builder\Form\AddBlockForm. There is no getEntity() available there, and the $block instance variable is protected so we can't get at it from this class.

  • πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ
  • Merge request !7Add block type to description β†’ (Open) created by karlshea
  • Pipeline finished with Failed
    4 months ago
    Total: 204s
    #261950
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ
  • Pipeline finished with Success
    4 months ago
    Total: 171s
    #262005
Production build 0.71.5 2024