Deprecation BlockController::Add

Created on 7 March 2023, over 2 years ago
Updated 8 March 2023, over 2 years ago

Problem/Motivation

Follow up from https://git.drupalcode.org/project/drupal/-/merge_requests/3535#note_156789

I think we can deprecate this and then call \Drupal\Core\Entity\Controller\EntityController::addPage
We should also remove this from routing.yml and use \Drupal\Core\Entity\Controller\EntityController::addPage via a route provider instead

Steps to reproduce

NA

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

πŸ“Œ Task
Status

Active

Version

10.1 ✨

Component
Block contentΒ  β†’

Last updated 6 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States smustgrave

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • First commit to issue fork.
  • last update over 1 year ago
    Custom Commands Failed
  • πŸ‡ΊπŸ‡¦Ukraine _shy Ukraine, Lutsk πŸ‡ΊπŸ‡¦
  • Pipeline finished with Failed
    over 1 year ago
    Total: 173s
    #39560
  • last update over 1 year ago
    30,422 pass, 14 fail
  • Pipeline finished with Failed
    over 1 year ago
    Total: 751s
    #39562
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine _shy Ukraine, Lutsk πŸ‡ΊπŸ‡¦

    I'm not sure if the function \Drupal\Core\Entity\Controller\EntityController::addPage() fits for that because this function has an argument $entity_type_id that should be passed from the route.

    Or, I just missed something important here.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    There is no need to deprecate - core controllers aren't part of the api unless marked as such.

  • Pipeline finished with Canceled
    over 1 year ago
    Total: 105s
    #66630
  • Pipeline finished with Failed
    over 1 year ago
    Total: 174s
    #66631
  • Pipeline finished with Canceled
    over 1 year ago
    Total: 697s
    #66635
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Pushed up some attempts. But currently have an issue where

    Create 2 block types
    Create a test editor and assign permissions for just 1 block type
    Login and try and create a block
    Button doesn't do anything.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    For the slack help.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    I think we'll need to make sure we keep the same route name for BC sake so if we move to a route provider, overriding the default name of entity.block_content.add_page to be the same as now will be required.

  • Pipeline finished with Failed
    over 1 year ago
    Total: 937s
    #66636
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • Pipeline finished with Failed
    over 1 year ago
    Total: 209s
    #66639
  • Pipeline finished with Failed
    over 1 year ago
    Total: 684s
    #66640
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
    block_content.add_form: '/block/add/{block_content_type}'
    block_content.add_page: /block/add
    block_content.type_add: /admin/structure/block-content/add
    block_content.type_add.bc: /admin/structure/block/block-content/types/add
    
    block_content.add_form: '/block/add/{block_content_type}'
    block_content.add_page: /block/add
    block_content.type_add: /admin/structure/block-content/add
    block_content.type_add.bc: /admin/structure/block/block-content/types/add
    

    So routes end up staying the same, so we are good.

    For #11 I removed the line adding the destination parameter to the "Add content block" button. Adding a block still redirect

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

    Will pick back up tomorrow

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • Pipeline finished with Failed
    over 1 year ago
    Total: 563s
    #66959
  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Think need approval on the removal of the destination parameter.

    The failures I currently have no clue about. Clearly missing a route setting

  • Pipeline finished with Failed
    over 1 year ago
    Total: 461s
    #66988
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    This has a lot of conflicts since πŸ› The block/add path is not redirecting Active (we probably should've just done this issue instead since EntityController::addPage has the same redirect logic XD)

    It might be easiest to start from scratch here, we also need to ensure we remove the route definition in block_content.routing.yml and rename the route as per #12

    I think what you were seeing in #14 was because this wasn't done.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    We can also remove the following routes from block_content.routing.yml:

    - entity.block_content.canonical
    - entity.block_content.edit_form
    - entity.block_content.delete_form

    Those match what DefaultHtmlRouteProvider provide

    Then we'll just have to alias the block_content.add_page and block_content.add_form routes

  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Canceled
    7 days ago
    Total: 213s
    #524039
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Pushed a WIP of what I've got so far, things are a bit more complicated because of 2 things:

    1. BlockContentController::addForm has special handling for query parameters that allow a theme to be set automatically when going from the block library to add a block content entity. These query params come from template_preprocess_block_content_add_list currently which is not compatible with the generic entity_add_list that EntityController uses.

    There's no easy way to override this so I've gone for a preprocess instead, we'll have to probably deprecate the block_content_add_list theme hook although I'd be worried if anyone was using this outside of core.

    2. As per above all of the entity.block_content.* routes are safe to remove because they match what the route provider is generating. The 2 aliases are going to be problematic for BC even if we don't deprecate them because people might be checking the string based route name, etc. I think the easiest for this issue may be to override ::getRoutes to swap the route names.

  • Pipeline finished with Failed
    7 days ago
    Total: 228s
    #524044
  • Pipeline finished with Failed
    7 days ago
    Total: 455s
    #524051
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Based on this search it looks like block_content_permissions and xp modules are the only contrib modules using this theme hook.
    https://git.drupalcode.org/search?group_id=2&scope=blobs&search=block_co...

    block_content_permissions is obselete according to its project page and xp is marked unsupported

  • Pipeline finished with Failed
    7 days ago
    Total: 622s
    #524713
  • Pipeline finished with Failed
    7 days ago
    Total: 780s
    #524727
  • Pipeline finished with Failed
    7 days ago
    #524741
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Failed
    7 days ago
    Total: 1105s
    #524748
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Failed
    7 days ago
    Total: 561s
    #524769
  • Pipeline finished with Canceled
    7 days ago
    Total: 462s
    #524785
  • Pipeline finished with Failed
    7 days ago
    Total: 548s
    #524788
Production build 0.71.5 2024