Use Drupal Field API for content tagging

Created on 11 April 2023, over 1 year ago
Updated 16 February 2024, 9 months ago

This is a plan for 12.0.0

Problem/Motivation

Currently our content tagging uses a combination of settings, hooks and alter hooks. This makes managing and extending the module difficult. The current settings are also dynamic based on a hook implementation which makes it impossible to define a schema for the config.

The current set-up also requires modules implement entity base field alter hooks and carefully manage the fields for their entities if they want tagging on custom entities.

Steps to reproduce

Proposed resolution

We remove the custom configuration and instead use the Field API to add a field_social_tagging field. This can be added through normal (optional) configuration files.

The settings screen is adjusted to work with entity view and form displays and switch out the widgets based on how the module is configured (e.g. allowing tag split vs only allowing a single category).

We create both a form widget and a display widget that supports the split configuration. We can fall back to the select2 form widget or the normal tag display widget for the non-split configuration.

The existing blocks that do a lot of custom rendering magic are replaced with blocks that render a new "tagging" display mode which contains only the tagging field. This block type can be placed in social_core and can be re-used for other places where we want to display a single field.

We add the https://www.drupal.org/project/entity_route_context dependency to allow us to create a single block instance for multiple entities with the view mode, this makes ensures we don't need a "profile tags", "group tags", "node tags" block, but can simply have a "tags" block.

Remaining tasks

User interface changes

API changes

Data model changes

🌱 Plan
Status

Needs review

Version

11.8

Component

Code (back-end)

Created by

🇳🇱Netherlands kingdutch

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

Comments & Activities

Production build 0.71.5 2024