Allows bundle classes to be configured using attributes. This removes the need to implement hook_entity_bundle_info_alter().
Bundle class attributes are now in core. Since 11.4.0 Entity bundle classes can be defined and discovered using the Drupal\Core\Entity\Attribute\Bundle attribute. Existing sites using this module will continue to work, new sites should use functionality from Drupal core. It should be possible to migrate to the core attribute simply by swapping the namespace in your use statements.
Example
<?php
namespace Drupal\my_module\Entity\Node;
use Drupal\bca\Attribute\Bundle;
use Drupal\Core\StringTranslation\TranslatableMarkup;
#[Bundle(
entityType: 'node',
bundle: 'article',
label: new TranslatableMarkup('Article'),
)]
class Article extends Node { }
Annotations
Prior to BCA 1.1.0 and Drupal 10.2.0 it is necessary to use annotations instead of attributes. The 1.1.x branch of this module supports using either annotations or attributes, while the 2.x branch supports only attributes. See the 1.1.x README for more details and examples.
Project information
- Project categories: Developer tools
- chart icon317 sites report using this module
- Created by mstrelan on , updated
- shieldStable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 2.0.x-dev updated 25 Jun 2026 at 22:42 UTC