- πΊπΈUnited States smustgrave
Closing as outdated as additional info was requested 6 months ago.
If still an issue please reopen with an updated issue summary
Thanks!
- Status changed to Needs work
almost 2 years ago 10:59am 17 February 2023 - π·π΄Romania amateescu
Just checked Drupal 10.1 and we don't have a CustomBlockSelection plugin, so this is still relevant, as well as the issue summary.
Here's a review for the patch:
-
+++ b/core/modules/block_content/block_content.module @@ -127,6 +128,12 @@ function block_content_add_body_field($block_type_id, $label = 'Body') { if ($query instanceof SelectInterface && $query->getMetaData('entity_type') === 'block_content' && $query->hasTag('block_content_access')) {
We should add a deprecation here to make developers aware of the new selection plugin, so we can remove this hook implementation in Drupal 11.
-
+++ b/core/modules/block_content/src/Plugin/EntityReferenceSelection/BlockContentSelection.php @@ -0,0 +1,30 @@ +class BlockContentSelection extends DefaultSelection {
This new selection plugin also needs to implement the two methods from
SelectionWithAutocreateInterface
:createNewEntity()
andvalidateReferenceableNewEntities()
. -
+++ b/core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php @@ -507,4 +511,100 @@ public function testCommentHandler() { + * Test the comment-specific overrides of the entity handler.
Copy/paste comment needs to be fixed.
-
- π¨πSwitzerland berdir Switzerland
1. Don't you get the per entity type selection plugin by default if you currently have that selected too? It wouldn't apply to a custom plugin, but then you probably know what you're doing and are filtering it out too? What I mean is, do we still need that hook at all, even now?
It's not clear to me why we're moving test coverage into system module, the logic is still in block_content, we could just keep the test, would be much easier to confirm that it doesn't change.
That it tests comment and other handlers is for historical reasons, it used to be in the entity_reference module and tests were moved into core/system.module when that was deprecated. If anything we should have separate issues to split that up and move it to where each handler is.