Allows bundle classes to be configured using attributes. This removes the need to implement hook_entity_bundle_info_alter().

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.

Supporting organizations: 

Project information

Releases