Needs work
Project:
Drupal core
Version:
main
Component:
taxonomy.module
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 May 2015 at 16:28 UTC
Updated:
12 Aug 2026 at 00:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
MarinkoIg commentedComment #2
MarinkoIg commentedAssigned to me.
Comment #3
MarinkoIg commentedI'm not sure that this attached patch is good solution.
Comment #4
phenaproximaShould be
$this->get('weight'), but otherwise looks correct to me.Comment #5
MarinkoIg commentedI added some changes..
Comment #6
thenchev commentedAs far as i can tell from the issue description you didn't had to add a setter. Maybe we need one?
Also if you are not sure about that return $this does look at this:
http://stackoverflow.com/questions/5956999/what-does-return-this-mean
It makes it so you can concatenate methods.
The other thing that you should do is you need to look in code in drupal everywhere the
$vocabulary->get('weight') is used and replace it with yours. Ides should have tools to search trough code and find where it its used
Comment #7
MarinkoIg commentedI changed..
Comment #10
MarinkoIg commentedComment #11
phenaproximaFirst-class.
Comment #12
miro_dietikerYeah, looks fine for me too.
Comment #15
miro_dietikerBack to original state. The test fail seem to have been random.
Comment #16
alexpottWe didn't implement methods for properties that had no runtime use-case. If we have a runtime use case then we should at it - atm this patch is only adding test-time usages.
Comment #23
andypostMeanwhile looks that weight of vocabularies are not used at all, so probably instead of interface extension better to remove weight from vocabularies.
In 4 years after conversion there was no reports about removal of sorting #1821274: Add back ability to sort on vocabulary weight and name
The only place where vocabulary weight was used was ordering of terms in term ref field #7684: Order taxonomy terms by vocabulary weight, then term weight
So I filed #3008064: Deprecate vocabulary weight property
Comment #36
jibranI have gone through all three issues: this one, #3008064: Deprecate vocabulary weight property, and #1821274: Add back ability to sort on vocabulary weight and name.
Re #16: At the time, that objection made sense, but now #1821274: Add back ability to sort on vocabulary weight and name is exactly that runtime use case:
TaxonomyIndexTid::valueForm()needs to sort terms by their vocabulary's weight, and doing that cleanly needs a propergetWeight()accessor rather than reaching into->get('weight')directly.So created a new MR https://git.drupalcode.org/project/drupal/-/merge_requests/16593.
Comment #37
smustgrave commentedLeft small comments on the MR.