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.12
Issue links:
Description:
Embed type plugins can now be declared with the #[EmbedType] PHP attribute (\Drupal\embed\Attribute\EmbedType) instead of the @EmbedType annotation. Annotations still work, but Drupal core is moving all plugin types to attributes, so new and updated plugins should use the attribute.
Before
namespace Drupal\my_module\Plugin\EmbedType;
use Drupal\embed\EmbedType\EmbedTypeBase;
/**
* @EmbedType(
* id = "my_type",
* label = @Translation("My type"),
* )
*/
class MyType extends EmbedTypeBase {
}
After
namespace Drupal\my_module\Plugin\EmbedType;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\embed\Attribute\EmbedType;
use Drupal\embed\EmbedType\EmbedTypeBase;
#[EmbedType(
id: 'my_type',
label: new TranslatableMarkup('My type'),
)]
class MyType extends EmbedTypeBase {
}
Impacts:
Module developers