By dave reid on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x-1.x
Introduced in version:
8.x-1.8
Issue links:
Description:
Entity Embed Display plugins can now be defined with the \Drupal\entity_embed\Attribute\EntityEmbedDisplay PHP attribute instead of the @EntityEmbedDisplay annotation. Annotated plugins are still discovered, but core now triggers a deprecation for each one, and core removes annotation discovery in Drupal 13 (see the core change record). Convert your plugins to the attribute.
Before
/**
* @EntityEmbedDisplay(
* id = "mymodule_display",
* label = @Translation("My display"),
* entity_types = {"node"},
* deriver = "Drupal\mymodule\Plugin\Derivative\MyDeriver",
* field_type = "entity_reference"
* )
*/
class MyDisplay extends EntityEmbedDisplayBase {
After
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\entity_embed\Attribute\EntityEmbedDisplay;
use Drupal\mymodule\Plugin\Derivative\MyDeriver;
#[EntityEmbedDisplay(
id: 'mymodule_display',
label: new TranslatableMarkup('My display'),
entity_types: ['node'],
field_type: 'entity_reference',
deriver: MyDeriver::class,
)]
class MyDisplay extends EntityEmbedDisplayBase {
The @EntityEmbedDisplay annotation is deprecated and will be removed in Entity Embed 2.0.0, ahead of core's removal in Drupal 13.
Impacts:
Module developers