Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Jan 2016 at 15:20 UTC
Updated:
19 Jul 2018 at 11:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hctomComment #3
hctomComment #4
dawehnerOne major difference between Drupal 7 and 8 here is that vocabularies are no longer stored in the database.
Given that vocabulary / node types ... etc. all don't have labels. Theoretically though you could write a generic bundle field handler, which can fetch the label, as needed.
Comment #5
webflo commentedComment #6
daniel_rempe commentedI try to take a step on this one.
Comment #7
daniel_rempe commentedLet's try this out
Comment #8
jeff cardwell commentedAfter adding the patch in #7, I was able to add a field for the vocabulary name in a view based on the table "taxonomy_term_field_data." However, the description appears as "Filter the results of 'Taxonomy: Term' to a particular vocabulary." which is incorrect. Also, the "category" might be more appropriately be "Taxonomy Vocabulary" rather than "Taxonomy Term."
Comment #9
dawehnerOh that patch is interesting. I mean the patch solves some of the problems, other fields obviously would not be supported, but its certainly an improvement.
Do you mind explaining why this would be wrong? This is kinda what I think this particular filter would exactly do.
Not sure about that to be honest. This kinda still is about the taxonomy term and having a category for just one field is kinda horrible.
Comment #10
daniel_rempe commentedIt seems to be a problem with default permission checks. The entity reference formatter is called and requires a permission handler for vocabularies.
Comment #11
daniel_rempe commentedNew patch with a vocabulary access control handler to grant view permissions for vocabularies on 'access content'.
Comment #13
daniel_rempe commentedCorrected patch format and added a test case patch.
Comment #14
daniel_rempe commentedComment #16
tstoecklerHehe :-), should be taxonomy and vocabulary, respectively.
Comment #17
daniel_rempe commentedFixed the copy & paste fragment. (Fix and test case included)
Comment #18
daniel_rempe commentedAdded use statement in test case.
Comment #19
tstoecklerYay, thanks a lot! :-)
Bot can set this back to needs work, if it wants otherwise, this is good to go.
Comment #20
jeff cardwell commented@dawehner
I admit that I am wading into something that I am mostly unfamiliar with but my comments were based on the the following screen shots from Views 3 in Drupal 7..
The description for the added field here differs from the description when the field is added as a filter.

It appears to me that the patch only addresses making the vocabulary name available in the "fields" section as it is already available in the "filters" section.
Additionally, while I agree that having a different category for one field is weird, I wasn't sure if there were plans to add the additional vocabulary properties that are available "out-of-the-box" in Views 3 for D7 in what I believe to be the same scenario. If that were the case, I would think that a separate category would be appropriate.
Of course, the new way that vocabularies are being dealt with in Drupal 8 may just mean that I'm confused... And if I am, no worries. I'll try not to clog up this queue with my misunderstanding. :)
Comment #21
dawehnerThe patch as it is looks totally alright for me.
Comment #22
stborchertRelated issue with patch for contextual filters: #2048733: Taxonomy vocabulary contextual filters are missing.
Comment #23
hctomThe patch applies cleanly without problems. Thanx for all your hard work.
But I also have to admit, that the field description is not really helpful, as it targets the filter and not the field.
Comment #24
tstoecklerRe @stBorchert #22: I wasn't aware of the other issue. I spoke to @Daniel_Rempe in person about this and he will post an updated patch which just "enables" the field, not the contextual filter or the sort. That means we should open another issue about the sort (including test coverage). Marking "needs work" until such an updated patch is posted.
Comment #25
daniel_rempe commentedChanged the field description to 'The vocabulary name' and removed the parts concerning sorts and filters.
Comment #26
tstoecklerThanks, let's get it in!
Comment #28
catchCommitted/pushed to 8.1.x, thanks!
I didn't commit this to 8.0.x because it has the string addition etc.
Comment #29
jibranLet's remove this string and fix the bug in 8.0.x.
Comment #30
catchThis need rolling back:
This isn't enough since the default permission is 'view content'. So going to roll back.
I got a merge conflict with git revert, so here's a rollback patch. Bumping to critical so it doesn't get forgotten.
Comment #32
catchComment #34
catchComment #36
catchComment #38
catchCan't reproduce the 8.1.x fail and 8.2.x passes. So back to CNR and sent for another retest.
Comment #40
catchComment #41
catchFigured out why so many re-tests failed. If an issue is at 8.0.x, then you move it to 8.1.x when submitting a patch, retest tests against 8.0.x
Comment #42
catchSince I only did a re-roll because git revert didn't work, and all tests green now, moving to RTBC.
Comment #43
alexpottCommitted the revert a2d1d2e and pushed to 8.1.x and 8.2.x. Thanks!
Comment #45
tstoecklerCould someone elaborate on the rollback? I'm afraid I don't really understand what #30 is trying to say.
Comment #46
catchThis meant that anonymous users could view admin/structure/taxonomy/$vocabulary since that relies only on the view permission.
Comment #47
tstoecklerAhh OK, thanks. I understand. That's certainly not ideal.
Comment #50
xjmFixing metadata since this is an 8.3.x issue at this point.
Comment #51
mikeker commentedI think the issue is that the vocabulary overview page (route
entity.taxonomy_vocabulary.overview_form) is not really an overview page but a page where you can rearrange the terms in a vocabulary. If we change the_entity_accesspermission to update instead of view, that should solve anonymous access to that page. Also fixed a copy/paste leftover in the test.Comment #52
berdirNot quite sure yet about the change, but we definitely need test coverage for the access check of that page then.
Comment #53
berdirActually, #2599128: Allow user with edit terms permission to access vocabulary overview does basically that and implements the view operation. I think we should wait on that issue and extend the test coverage there a bit more on anonymous access, get that in and then this will be fine as it was before (after merging the access control handler, that is)
Comment #58
berdir#1848686: Add a dedicated permission to access the term overview page (without 'administer taxonomy' permission) now solves the overview problem, so once that is in, this issue can focus on the vocabulary name problem. #2808217: To be able to view Vocabulary config entities via REST, one should not have to grant the 'administer taxonomy' permission is also a related issue which wants to do basically the same.
A possible fix for this would also be to use the new view label operation, which is now respected by the entity label formatter thanks to #2692091: Use the new 'view label' entity access check in the entity reference label formatter.
Comment #60
lendudeReroll was needed and serious refactoring after all the other issues have landed (so no interdiff). Also converted the test to a kernel test.
Comment #61
s.messaris commentedThanks for the patch in #60, worked like a charm for my needs. +1 for RTBC.
Comment #62
ifrikThe patch works for me. By adding a relationship for the taxonomy term, it becomes possible to add the vocabulary as a field.
Comment #64
lendudeRemoved the deprecated call
Comment #65
s.messaris commentedRemovig the deprecated call is reasonable. Setting back to RTBC.
Comment #67
catchCommitted 4dc2f4a and pushed to 8.6.x. Thanks!
Comment #68
hctomThanks for all you hard work on this - happy to see it merged now!
Comment #69
jibranI have two questions:
Comment #70
jibranWe do need an update hook see
views_update_8004,views_update_8005andviews_update_8100Comment #71
jibranHere you go
Comment #72
berdirTo be honest, I don't really understand the policy to do this, as afaik the recommendation is that you should always clear caches when updating. Then again, drush updb is "intelligent" enough to not clear caches if there are no updates.
But it is consistent with what we did elsewhere AFAIK.
Comment #73
hctom@Jibran: According to the change record https://www.drupal.org/node/2960601 cache clears shouldn't be executed via update hooks anymore. It is recommended to use
hook_post_update_NAMEinstead. Perhaps this should be used instead.Comment #74
jibran@hctom I wonder who worte that change record 🤔. HOOK_update_N and HOOK_post_update_NAME both are called update hooks and yes, I have implememted HOOK_post_update_NAME in the patch :). Please have a look at the patch once again.
Comment #75
hctom@jibran: i'm really sorry - i guess i shouldn't write in the issue queue that late at night ;) of course your patch is totally okay!
Comment #76
catchCommitted 679fe1f and pushed to 8.6.x. Thanks!
Comment #78
jibranAs per https://www.drupal.org/core/backport-policy, @catch can you please state your reason to not backport this to 8.5.x? I don't think this is disruptive at all.