Update taxonomy term base fields (parent and weight) to be configurable on form display

Created on 13 July 2020, almost 5 years ago
Updated 15 January 2024, over 1 year ago

Problem/Motivation

1. As stated in #2751001: Expose configuration for Relation , users, such as site builders, are unable to control the visibility of Relations for a term via the Manage form display page or the taxonomy edit page. Some taxonomies may not require parent-child relations and therefore would not require the Relations for a term to be displayed on the create/edit page.

2. Related to the first point, being unable to control the visibility of Relations for a term, there is an issue when having a taxonomy with large sets of terms. Due to the backend form code of ensuring that A term can't be the child of itself, nor of its children, \Drupal\taxonomy\TermStorageInterface::loadTree() and \Drupal\taxonomy\TermStorageInterface::loadParents() are called, which can cause memory errors, WSOD, etc. Based on where this process is, a hook_form_alter() is too late to prevent these functions from being called. There is an if statement and a comment that states that switching taxonomy.settings:override_selector to TRUE would skip the calling of these functions, but this isn't very user friendly to a site builder and was not super easy to decipher prior to digging in the code.

Proposed resolution

1. Convert the Parent and Weight Base Fields to be available and controlled via the Manage form display page for Taxonomy Terms in core/modules/taxonomy/src/Entity/Term.php
2. Move the Relations form functionality to a hook_form_alter() in taxonomy.module
3. Remove the Relations form functionality from core/modules/taxonomy/src/TermForm.php

Remaining tasks

Run tests and potentially modify test cases

Feature request
Status

Needs work

Version

11.0 🔥

Component
Taxonomy 

Last updated about 13 hours ago

  • Maintained by
  • 🇺🇸United States @xjm
  • 🇬🇧United Kingdom @catch
Created by

🇨🇦Canada nord102

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024