BlockContentSelectionExtendsRector
Entity reference selection plugins for block_content that extend DefaultSelection must extend BlockContentSelection instead, to avoid the deprecated automatic reusable-block filtering hook.
use Drupal\Core\Entity\Attribute\EntityReferenceSelection;
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
use Drupal\Core\StringTranslation\TranslatableMarkup;
#[EntityReferenceSelection(
id: "mymodule:block_content",
label: new TranslatableMarkup("My block content selection"),
group: "mymodule",
entity_types: ["block_content"],
)]
-class MyBlockContentSelection extends DefaultSelection {
+class MyBlockContentSelection extends \Drupal\block_content\Plugin\EntityReferenceSelection\BlockContentSelection {
}
Configure your rector.php:
<?php
use DrupalRector\Drupal11\Rector\Deprecation\BlockContentSelectionExtendsRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
BlockContentSelectionExtendsRector::class,
]);