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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

psf_ created an issue. See original summary.

psf_’s picture

I fix a minimal style issue in README.md.

I added a output to the field formatter.

I extend the field widget to allow select any bundable content entity type in widget settings.

psf_’s picture

Assigned: psf_ » Unassigned
Status: Active » Needs review
juandels3’s picture

Assigned: Unassigned » juandels3
psf_’s picture

@juandels3 , please, could you release the 1.0.x-dev branch?

  • juandels3 committed 69124d7c on 1.0.x
    #3482145: update category to new API requirements
    
    See https://www....
juandels3’s picture

Version: 1.0.1 » 1.0.x-dev
Status: Needs review » Reviewed & tested by the community

Thank you for your contribution @psf_ :)

I have been testing the changes you have implemented. I have patched a small bug in the code (more info here https://www.drupal.org/node/3375748). I will prepare a new release with the new features.

psf_’s picture

Version: 1.0.x-dev » 1.0.1
Status: Reviewed & tested by the community » Needs review

Thx to u :_ D

psf_’s picture

Version: 1.0.1 » 1.0.x-dev
Status: Needs review » Fixed

Updated issue status, I changed it before by mistake.

Merged and released in v1.0.4 : )

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.