Create a constant for root term ID

Created on 17 November 2023, almost 2 years ago
Updated 1 March 2024, over 1 year ago

Problem/Motivation

Follow up from โœจ Create TermInterface methods ::hasRootParent(), ::hasNonRootParent() Needs review
The taxonomy term can have root(0) as parent, which is hardcoded at multiple places.
So as per the suggestion in the related issue, it was advised to create a constant for the root and use that constant instead of hardcoding 0.
Comment link - https://git.drupalcode.org/project/drupal/-/merge_requests/5171#note_231753
E.g
if ($term->parents[0] == 0)

Steps to reproduce

NA

Proposed resolution

  1. Add a constant
  2. Replace hardcoded 0 used for root parent with the constant

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Taxonomyย  โ†’

Last updated 2 months ago

  • Maintained by
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States @xjm
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @catch
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024