Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Bundle Class Attributes

Security covered Under active development 498 sites

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.

Drupal 10–11 PHP >=8.1

Ask your assistant about Bundle Class Attributes

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Oct 2023
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.0.x-dev Dev 11 Jun 12, 2026
1.1.1 Stable 10–11 PHP >=8.1 Jun 4, 2024
1.1.0 Stable 10 PHP >=8.1 Dec 18, 2023
1.1.x-dev Dev 10–11 PHP >=8.1 Oct 29, 2023