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

Created on 13 July 2020, over 4 years ago
Updated 15 January 2024, 12 months 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 29 minutes 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.

  • 🇸🇮Slovenia g1smo

    Re-rolled D9 patch from #18 so that it work on Drupal 10.2.1

    Looking forward to getting this merged. It's necessary when trying to change the parent term of a large vocabulary.

  • 🇸🇮Slovenia g1smo

    Re-rolled the patch the patch from #18 to work on Drupal 10.2.1

  • 🇸🇮Slovenia g1smo

    I've also created an issue fork.

  • Pipeline finished with Failed
    12 months ago
    Total: 184s
    #78157
  • Pipeline finished with Failed
    12 months ago
    Total: 187s
    #78165
  • Pipeline finished with Failed
    12 months ago
    Total: 202s
    #78195
  • Pipeline finished with Failed
    12 months ago
    Total: 170s
    #78201
  • Pipeline finished with Failed
    12 months ago
    Total: 757s
    #78207
  • Pipeline finished with Failed
    12 months ago
    Total: 490s
    #78225
  • Pipeline finished with Failed
    9 months ago
    Total: 641s
    #122577
  • Pipeline finished with Failed
    9 months ago
    Total: 687s
    #137378
  • Pipeline finished with Canceled
    7 months ago
    Total: 224s
    #178575
  • Pipeline finished with Failed
    7 months ago
    Total: 546s
    #178581
  • After applying this "taxonomy_base_polja.patch" patch, all the existing selection of parent term for existing vocabularies are no longer there. As it is considered as new field. Any solutions to keep the previous selections of parent terms for existing taxonomy terms?

  • 🇸🇮Slovenia g1smo

    @ashkay9
    Existing values should be there, this patch lets you change the parent term widget in "form display".
    Worked well for me on Drupal 10, which version are you on?

  • 🇨🇦Canada nord102

    Re-rolled patch to apply to 10.3

Production build 0.71.5 2024