Use the same permission as CCK for the HS config form for a field

hefox - October 27, 2009 - 14:50
Project:Hierarchical Select
Version:6.x-3.x-dev
Component:Code - Content Taxonomy
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Description

The content module changes the content type name in the url of content types with underscore to a hyphen, hierarchical select does not but it's back to field configuration does not realize that and uses the underscored verison.

Pending remembering to, I can make a patch when I get back from work; unless anyone can think why not it's likely best if the url uses the hyphen for Hs Config instead of just fixing that link?

#1

Wim Leers - October 27, 2009 - 16:49
Priority:normal» minor

Nice find!

I'll happily welcome and commit your patch :)

#2

hefox - October 28, 2009 - 00:37

Hm, I went a bit insane with this and tried doing it like content_menu did it (define a menu entry for each field/content_type). Had to add in an additional hook implementation (content_fieldapi) to ensure that menu is rebuilt.

If this is a bit too much, there was also two additional issues. The menu entry was using the wrong permission (administer site configuration instead of administer content types) and there was no checking that the item was a hierarchical select item since any field, typename is accepted (solved by only having menu entries for the necessary fields/content types).

AttachmentSize
underscore_hyphen.patch 5.15 KB

#3

Wim Leers - October 30, 2009 - 23:59
Title:Back to the field configuration leads to page not found when underscore in node type» 'Back to the field configuration' link leads to 404 when underscore in node type
Status:active» fixed

WOW. I appreciate your contribution, but that's an extremely overkill solution. A simple string replace will do.

http://drupal.org/cvs?commit=281970

#4

hefox - October 31, 2009 - 02:02

Ah, I see it now and see where some of most of my road block came from:
There's an not needed line in hs_taxonomy_form()

<?php
218     
'#options' => $options,
?>

I managed to comeptly not realize that that was an unused, uninitialized variable.

It'd be nice if hs_taxonomy could be weighted at the same level as taxonomy would be, which would have avoided some of issue since most taxonomy modules expect to run after taxonomy, but i8ntaxonomy remaking of the taxonomy array proves problematic to do. Of course, could weight i8ntaxonomy below hs_taxonomy..

#5

Wim Leers - October 31, 2009 - 02:12

That was necessary due to #475784: #options set by forum module, this causes a validation error. What you could do, is change the weight back to 1 and then unset #options from within HS itself, at the end of the #process callback.

But please discuss that in #601500: HS Taxonomy interaction with other modules (content_taxonomy, unhides taxonomy fields)! :)

#6

hefox - October 31, 2009 - 03:33

(Oops, I meant to post in that one. And got reaally confused when I didn't see my last post till looked over at this issue).

Anyhow looked at the commit; there's two other issues I noticed while doing above, sorry for not mentioning them more clearly; I think the hs config form doesn't check if the field is a hs widget so would show for invalid fields and the permission does not match the regular field form permission, though I can't imagine someone with administer content types but not administer site configuration.

#7

Wim Leers - October 31, 2009 - 09:25

I think the hs config form doesn't check if the field is a hs widget so would show for invalid fields

Indeed, but that can't hurt. To do that, you'd have to actually manufacture such an URL. I'll gladly accept patches to fix that though, but not in the way you wrote it (i.e. adding menu callbacks), it should work using _load() functions that verify the existence dynamically.

permission does not match the regular field form permission, though I can't imagine someone with administer content types but not administer site configuration.

Exact same answer as above :)

#8

hefox - October 31, 2009 - 14:28

Attached is the permission change.

Not bothering with the other one; it'd need a different access callback that checks on content type/field permission or something

If you want to see something quite funny, try adding drupal_not_found to a hs_content_taxonomy_config_form . It puts the entire not found page inside the the $content of the page sorta.

AttachmentSize
hs_taxonomy_permision.patch 681 bytes

#9

Wim Leers - October 31, 2009 - 19:18
Title:'Back to the field configuration' link leads to 404 when underscore in node type» Use the same permission as CCK for the HS config form for a field

Committed. http://drupal.org/cvs?commit=282150

#10

System Message - November 14, 2009 - 19:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.