- πΊπΈUnited States smustgrave
Now that we have moved block_content we may be able to remove the dependency.
- Merge request !4212Issue #3206952: Why block_content depends on block? β (Open) created by smustgrave
- last update
over 1 year ago 29,462 pass, 17 fail - last update
over 1 year ago 29,462 pass, 17 fail - Status changed to Closed: works as designed
over 1 year ago 10:45pm 19 June 2023 - πΊπΈUnited States smustgrave
So tested removing block as a dependency and can already see failures happening.
Seems like it would be more effort to remove block. There's also a preDelete call on the entity
parent::preDelete($storage, $entities); /** @var \Drupal\block_content\BlockContentInterface $block */ foreach ($entities as $block) { foreach ($block->getInstances() as $instance) { $instance->delete(); } }
Which seems dependent on block.
Going to say this works as designed if anyone disagrees please reopen explaining why
Thanks!
- π¦πΊAustralia mstrelan
I think it should still be possible to remove the dependency on block.module, it just may need a bit of refactoring.
The \Drupal\block_content\BlockContentInterface::getInstances
method (used inpreDelete
) provides special handling for block.module but completely ignores layout builder. It probably makes more sense to have a separate service for this integration, and the block instance deletion should probably be implemented in a hook. In other words, theBlockContent
entity should have no awareness ofBlock
entities. - Status changed to Active
over 1 year ago 12:27am 20 June 2023 - Status changed to Needs review
about 1 year ago 4:13pm 21 December 2023 - Status changed to Needs work
about 1 year ago 5:46am 3 January 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
We haven't addressed #11 and #12 yet.
Which leads me to believe we're missing test coverage for that when block.module is disabled.
\Drupal\block_content\Entity\BlockContent::getInstances should hard fail when the block entity-type doesn't exist.
There's also a reference to block.admin_library in block_content.links.action.yml - it would be good to confirm that doesn't cause any side-effects.
block_content_add_action: route_name: block_content.add_page title: 'Add content block' appears_on: - block.admin_library ## here - entity.block_content.collection class: \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction