Allow reference bundles from any content entity type

Created on 21 October 2024, about 1 month ago

Problem/Motivation

The "Entity Bundle Field" module currently supports referencing only Content Types and Vocabularies in its field type, limiting its use to these two entity types. As Drupal has evolved to allow for a variety of "bundlable" entities, the module could be improved to support referencing any "bundlable" entity installed in the system, enhancing its flexibility and usefulness.

The expansion of the "Entity Bundle Field" module to support all "bundlable" entities will significantly enhance the module's flexibility and applicability. As Drupal continues to evolve into a more robust and versatile platform, the ability to reference a wide array of entity types becomes increasingly important, especially in complex or custom implementations.

By enabling the module to reference any "bundlable" entity, we open up a myriad of possibilities for site builders and developers to create more dynamic and interconnected data structures. This improvement aligns with Drupal's philosophy of modularity and interoperability, allowing other contributed and custom modules to extend the core functionality further.

For the community of users, particularly those working on decoupled Drupal setups, the ability to easily reference and expose different entity types to the frontend can streamline the build process and reduce the need for custom solutions. This change will also encourage best practices in data architecture, as site builders can now utilize the "Entity Bundle Field" to create cleaner and more maintainable data relationships.

In summary, this proposed enhancement will contribute to the robustness of the Drupal project, improve developer experience, and ultimately provide a richer feature set for end-users.

Steps to reproduce

Currently, when one tries to reference an entity bundle other than Content Types or Vocabularies using the "Entity Bundle Field" module, there is no option available.

Proposed resolution

The proposed resolution is to modify the "Entity Bundle Field" module to:
- Check for all "bundlable" entity types in the system instead of only Content Types and Vocabularies.
- Allow administrators to select from a list of all available "bundlable" entities when configuring the field.

The necessary changes could include:
- Adjusting the field type definition to dynamically pull in a list of all "bundlable" entities.
- Ensuring the field type can handle and store references to any "bundlable" entity, not just Content Types and Vocabularies.

Remaining tasks

- Review the current codebase for the "Entity Bundle Field" module.
- Implement changes in the module to support all "bundlable" entities.
- Ensure backward compatibility for sites already using the module with Content Types and Vocabularies.
- Thorough testing with various "bundlable" entities.
- Documentation updates to reflect the extended capabilities of the module.

User interface changes

The user interface within the field configuration will change to present a list of all "bundlable" entities, which could be larger than the current list.

API changes

The way the module interacts with entities will be expanded, but these changes will be backwards compatible.

Data model changes

Existing data structures should remain unaffected; however, the field settings will need to accommodate references to the broader range of entities.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain psf_ Huelva

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024