Drupal is a registered trademark of Dries Buytaert
Search API Solr 4.4.0 Minor update available for module search_api_solr (4.4.0). Page Manager 8.x-4.0 Major update available for module page_manager (8.x-4.0). Trash 3.1.0-beta2 New beta version released for module trash (3.1.0-beta2). Commerce AutoSKU 3.0.1 Minor update available for module commerce_autosku (3.0.1). Custom Field 4.0.10 Minor update available for module custom_field (4.0.10). Alternative login ID & display names 2.0.12 Minor update available for module alt_login (2.0.12). EntityReference UUID 3.0.1 Minor update available for module entity_reference_uuid (3.0.1). LocalGov Publications Importer 1.1.1 Minor update available for module localgov_publications_importer (1.1.1). Configuration Override Warn 8.x-1.6 Module config_override_warn updated after 10 months of inactivity (8.x-1.6). Table Alternate Rows Module table_altrow crossed 1,000 active installs.

This module allows developers to define entity bundle classes using attributes within their code, eliminating the need for hook implementations. This approach simplifies bundle class configuration for Drupal entities.

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.

Activity

Total releases
1
First release
Jun 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
2.0.x-dev Dev Jun 12, 2026