- First commit to issue fork.
- Merge request !5143Issue #3346394: Deprecation BlockContentController::Add β (Open) created by _shy
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 30,422 pass, 14 fail - Status changed to Needs work
over 1 year ago 8:20pm 26 October 2023 - πΊπ¦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.
- πΊπΈ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
smustgrave β credited larowlan β .
- π¦πΊ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.
- πΊπΈ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 Kingdom AaronMcHale Edinburgh, Scotland
smustgrave β credited AaronMcHale β .
- πΊπΈUnited States smustgrave
Closed π [PP-1] Provide a "add" link template for the block_content_type entity type Closed: duplicate as a duplicate
- 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
- π¦πΊ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_formThose match what DefaultHtmlRouteProvider provide
Then we'll just have to alias the block_content.add_page and block_content.add_form routes
- π¦πΊ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 fromtemplate_preprocess_block_content_add_list
currently which is not compatible with the genericentity_add_list
thatEntityController
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. - π¦πΊ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
- π¦πΊAustralia acbramley
Postponed now on
π Fix \Drupal\Core\Entity\Controller\EntityController so bundles are sorted by label and not ID Needs work
π BlockContentType should implement EntityDescriptionInterface Active