Explore the notion of renderers for bundles classes

Created on 16 October 2022, over 2 years ago
Updated 7 February 2023, over 2 years ago

Problem/Motivation

The bundle classes are awesome. I'm implementing a system that makes heavy use of them and the level of code encapsulation and reusability is fantastic. IMHO this feature marks the start of a new era in Drupal.

However, some stuff still needs to be handled in hooks, namely

  1. hook_entity_view to be able to show any output
  2. hook_entity_extra_field_info to make it available on the Manage display page of the Bundle

Proposed resolution

Add methods that would allow to do the work done in the above-mentioned hooks in the Bundle Class.

✨ Feature request
Status

Needs review

Version

10.1

Component

entity system

Created by

πŸ‡΅πŸ‡±Poland blazey

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    I would think we'd like to keep the presentation logic separate from the business logic.

    I think perhaps we should move this to the ideas queue and flesh out a design, so I've done that

    One thing that I think is worth exploring is something like Bundle class attributes β†’

    @mstrelan pointed out in slack that the Typed Entity module has an API for 'renderers' and that feels like it provides additional layers of separation.

  • Status changed to Active 3 days ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    The Ideas project is being deprecated. This issue is moved to the Drupal project. Check that the selected component is correct. Also, add the relevant tags, especially any 'needs manager review' tags.

    Changing to the standard issue template β†’ would also help other contributors.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    Now that hooks can be implemented with attributes, can’t we have bundle classes implementing any needed hooks directly? What else is there to now explore?

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Hooks have to be in the hooks namespace for now until https://www.drupal.org/project/drupal/issues/3481903 ✨ Support hooks (Hook attribute) in components Active

    But maybe we do that other one first.

Production build 0.71.5 2024