Can't add core Page Title block

Created on 9 March 2023, almost 2 years ago
Updated 5 May 2023, over 1 year ago

Problem/Motivation

When I'm adding a block to a category, I would like to be able to add the core "Page Title" block as an option for content editors to choose.

Steps to reproduce

1. Visit `/admin/config/content/layout-builder-browser/categories` and add a block category
2. Then go to `/admin/config/content/layout-builder-browser` and click "Place block" next to the newly created category.
3. For "Provider" choose "core"
4. Notice that there are only two options, "Primary admin actions" and "Tabs". There are lots of other core blocks that could appear here. I'm specifically looking for the page title block.

Proposed resolution

Add more core blocks to the picker, specifically the page title block.

Remaining tasks

None.

User interface changes

Additional options for core blocks under the "Block" dropdown.

API changes

Probably not.

Data model changes

Probably not.

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States codechefmarc

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

Comments & Activities

  • Issue created by @codechefmarc
  • Status changed to Closed: duplicate almost 2 years ago
  • πŸ‡«πŸ‡·France vbouchet

    Hi @codechefmarc,

    Thanks for reporting. I think it is fixed now with https://www.drupal.org/project/layout_builder_browser/issues/3228122 πŸ› Provider Category for Entities get mixed into one category Fixed . I am closing the ticket but feel free to reopen if it is still an issue (please note that it is for now on the -dev version only, I have not released a new version yet).

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

    Hi @vbouchet, thanks for the quick response! I just checked with version 1.5 and I am seeing a lot more choices in the "Provider" dropdown, but I still can't see the core title block when I select "core". When I have some time soon, I'll see if I can look into why that is happening, but wanted to let you know.

  • πŸ‡«πŸ‡·France vbouchet

    Hi @codechefmarc,

    I am reopening the issue. I though the "Title ()" block was the block you were talking about but I realize when checking at the block layout that there is a simple "Page title" option in the core provider.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States kevinquillen

    This looks like it is because of Layout Builder itself. The code in question:

    /**
     * Implements hook_plugin_filter_TYPE__CONSUMER_alter().
     */
    function layout_builder_plugin_filter_block__layout_builder_alter(array &$definitions, array $extra) {
      unset($definitions['system_main_block']);
      // @todo Restore the page title block in https://www.drupal.org/node/2938129.
      unset($definitions['page_title_block']);
    }
    

    Issue: πŸ› PageTitle block is non-functional when not handled directly by \Drupal\block\Plugin\DisplayVariant\BlockPageVariant Postponed

  • Status changed to Needs work over 1 year ago
  • πŸ‡«πŸ‡·France vbouchet

    Hi @kevinquillen,

    I did not found that specific code when I checked some weeks ago but I found a similar code where the main_block is explicitly added to the list of blocks (not exactly sure in which context). I concluded that we have to do the same in Layout Builder Browser to list it down.

  • πŸ‡«πŸ‡·France vbouchet

    Not sure I will have a lot of time in the next week to focus on this so reporting my latest tests.

    In the BlockForm.php around line 73 (the code responsible for the form when clicking the "Add block" button to associate a block with a category) and BrowserController.php around line 144 (the code responsible for displaying the browser), I added the "Page title" block into the definitions list:

    $definitions['page_title_block'] = $this->blockManager->getDefinition('page_title_block');
    

    I was able to create a block using the "Page title" core block in a category. I was able to place a "Page title" block in a section. However, the block was not rendering the expected content. I am using the default Olivero theme on my dev instance. The "Page title" block placed using the Block layout (admin > structure > block layout) displays the page title + the star to add the page to the personal shortcut menu. Adding the "Page title" block in the section only shows the star.

    I was expecting that adding the block definition would be enough. Need to dive to understand why it is not the case.

Production build 0.71.5 2024