Make section library template entities fieldable

Created on 19 April 2024, 7 months ago
Updated 30 April 2024, 7 months ago

Problem/Motivation

It would be great to be able to do things like categorize templates. This would allow for improving the UI as the template library gets large as well as the potential to expose only certain templates to groups of users with modules like workbench_access.

✨ Feature request
Status

Needs review

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jastraat

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

Merge Requests

Comments & Activities

  • Issue created by @jastraat
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    I'm attaching a patch that does the most minimal job of making section library templates fieldable. It adds no new routes and uses the entity collection route as the base for managing the field UI. It adds no new classes or menu items and does not add fields to section_library's custom "add to library" forms.

    This also doesn't include an update hook for sites that already have section_library installed; that would be a good enhancement.

    However, with this patch in a site installing section_library for the first time, the following are true:

    • Add additional fields to section templates at /admin/content/section-library/fields
    • Manage the edit form display and the edit form (which is more content entity vanilla) will display all the fields as you have configured them.

    Users could alter the add to library forms using route subscribers to define their own form classes or with form alter hooks to add fields as desired to those forms.

    Future enhancements could include:

    • Altering the add to library forms so that they automatically include the custom fields
    • Adding an entity type update hook for sites already using section_library
  • πŸ‡ΊπŸ‡ΈUnited States jastraat
  • Status changed to Needs review 7 months ago
  • Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • πŸ‡ΊπŸ‡ΈUnited States jastraat
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    The latest MR also converts the image field to a true image field which allows for applying image form options for example. Note: this is another change that requires an entity update.

  • Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
Production build 0.71.5 2024