Problem/Motivation
The only place where vocabulary weight were used is sorting terms in term reference field #7684: Order taxonomy terms by vocabulary weight, then term weight
While vocabularies were converted to config entities we removed this ability with follow-up #1821274: Add back ability to sort on vocabulary weight and name
This feature was requested only once in #2969183: Vocabulary weight not honoured by Entity Reference fields
Proposed resolution
Deprecate this property and remove its usage
The only usage is VocabularyListBuilder
which will needs to stop extends DraggableListBuilder
- this may affect BC policy and, probably, some contrib
Remaining tasks
- discuss deprecation (actually list builder and tests)
- create change record and patch
- commit
User interface changes
- vocabularies no longer sorted at admin/structure/taxonomy
API changes
- VocabularyListBuilder
extends ConfigEntityListBuilder
instead of DraggableListBuilder
Data model changes
taxonomy_vocabulary
config no longer export weight
property
Comment | File | Size | Author |
---|---|---|---|
#21 | 3008064-21.patch | 1.34 KB | andypost |
Comments
Comment #2
mattjones86I have to say I'm not a great fan of removing this feature. I can think of at least 3 Drupal (7/8) projects I've done in the last few years which have relied on this to sort vocabularies in custom filter blocks etc.
I can't be the only developer in the world who uses it, and I expect most who do will be doing something custom with
\Drupal::entityQuery()
where it works, and will not necessarily notice the ongoing bugs/issues with views/entityreference.If it's decided that it's really not needed then I guess it's fine to depreciate for
8.x
it and flag for removal in9.x
, however I still believe the more sensible approach is just to fix the bugs with the existing implementation.Comment #3
andypost@mattjones86 please elaborate how you did use weight, specifically in d8. It is totally not clear how weight of vocabulary related to blocks
Comment #4
mattjones86Hi @andypost,
We've used it to allow customers to change the order of their filters as below:
Using the drag/drop feature of the core vocabularies is much more convenient than implementing something custom.
Comment #5
Chi CreditAttribution: Chi commented@mattjones86, your case is valid but too specific. The filter on the screenshot is made with custom code, I suppose. From this point we should also add weight property to content types because it may have the same use case.
Out of box this property is not used in Drupal 8 and that makes the draggable inteface on admin/structure/taxonomy page confusing.
Even resolving #2969183: Vocabulary weight not honoured by Entity Reference fields will make a little difference. Implementing draggable interface just to specify order of vocabularies on field settings form seems redundant to me.
Comment #7
andypostComment #8
mmenavas CreditAttribution: mmenavas as a volunteer commentedI stumbled upon this discussion because I was looking for a way to programmatically get the weight property for my vocabularies.
My use case is similar to @mattjones86. I'm building a site with a search page that has several filters, where each filter corresponds to a vocabulary.
I understand that one of the arguments for removing the weight property is that Drupal core does not use it anywhere. However, that feature has been around since Drupal 5 (according to https://www.drupal.org/docs/7/organizing-content-with-taxonomies/create-...), and there might be more developers (like mattjones86 and me) who need this feature but aren't voicing their opinion because they don't know this discussion is happening.
@Chi wrote on comment #5:
Not necessarily! AFAIK Drupal never offered a weight property for content types, and I'm not aware of any feature requests that ask for it.
Comment #9
andypostBoth cases are about filters so I see it like
- case of views exposed filters - order defined in view
- case facets - ordering by block placement or by facet's weight #2957950: Add views area plugin
Comment #10
andypostStarting patch to get number of usage
Comment #12
mattjones86@andypost thanks for your feedback on this.
I don't believe either of the replacements you've suggested are suitable for site editors - for developers perhaps. In my opinion the only suitable replacement would be to use the Entityqueue module to allow the vocabulary list to be sorted with drag+drop.
This would provide the a similar editing experience (although somewhat clunkier) at the cost of quite a bit of performance and development overhead.
My 2p is that I really don't understand the rationale for removing a core feature which has very little support requirements from Drupal's side. If it was causing problems in other parts of the code or lots of support tickets then I could totally understand.
Also the agument that "'Content Types' don't support this" is not really valid, since the Taxonomy and Node modules were build to solve totally different problems and have very different requirements.
This is going to cause real problems for me and block me upgrading sites to Drupal 9, I'd be very surprised if I'm the only one!
Comment #20
MULK CreditAttribution: MULK commentedHi everybody!
I have the problem because the same case as @mattjones86 here. Filters order.
Comment #21
andypostFiled CR https://www.drupal.org/node/3347694
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedWill this need a deprecation test?
Comment #24
andypostI still think we can deprecate it
Maybe we need UX team as well
Comment #25
andypostProbably we still need to solve sorting of filters via #1821274: Add back ability to sort on vocabulary weight and name but second related could be closed - no reason to extend interface
Comment #26
mattjones86I still think you're going to be unpleasantly surprised how many developers were quietly using this without ever stumbling across this issue or having any input on the discussion.
For me personally (a single isolated developer), this will probably be adding £1000 to the next core upgrade to cover developing a custom solution to replace what was previously a core feature.
Hopefully someone will just re-implement this in contrib quickly.
Comment #27
KingdutchStumbled across a related feature request: #3107650: Unable to sort by term weight for contextual filter: term Name
Comment #29
Wim LeersNote that #3008064: Deprecate vocabulary weight property is marking this fully validatable, and is adding the following changes wrt
weight
's config schema:👆 That amounts to no changes at all: it just means that any integer is accepted. It also means that it should remain trivial for this issue to deprecate
weight
👍Comment #30
Wim Leers#29: that
@todo
should be converted to a follow-up issue that will remove it if #2002174: Allow vocabularies to be validated via the API, not just during form submissions lands first.Comment #31
catchI'm not convinced this is worth removing and lean towards doing #1821274: Add back ability to sort on vocabulary weight and name instead. The big difference between taxonomy vocabularies and content types is they're much more often exposed or combined into a single list etc.
Comment #32
Wim LeersThat means we should mark this #1821274: Add back ability to sort on vocabulary weight and name. #2, #8 and others indeed suggest this is actively being used.
and leave a comment onDone.