Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2010 at 01:50 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhodgdonAs another data point, on the Theme settings page, I have the box unchecked that says "Use the administration theme when editing or creating content"
Comment #2
Anonymous (not verified) commentedI'm afraid that I don't quite understand what you're trying to describe. Could you please be more descriptive.
Comment #3
kaakuu commented@jhodgdon - apparently selecting or unselecting that box has no effect on the outcome. I get the same results as you.
@JoshuaRogers - followed these steps to reproduce the above error
Installed d7
Either it is already enabled or enable Seven via http://localhost/d7/#overlay=admin%2Fappearance as Administration theme - "Use the administration theme when editing or creating content " box can be checked or unchecked. Thus Seven is Administration theme, and Garland is site default theme.
Now come to http://localhost/d7/#overlay=admin%2Fstructure%2Ftaxonomy%2Fadd and "add vocabulary"
Now "add terms" - add any term
Now hit "edit" for that added term
Instead of Seven Garland shows up. ( It was expected that it will be still Seven)
Comment #4
jhodgdonJust to clarify again:
If I am doing "term add", the Admin theme is used.
If I am doing "term edit" (which uses the same editing form), the site default theme is used, not the Admin theme.
Comment #5
Bojhan commentedWhat you want is - that in /admin this link goes to Seven but when you are in your Garland theme this link goes to Garland.
Comment #6
jhodgdonWhat do you mean, "when you are in your garland theme"? You mean if I clicked on the edit link from the list of terms taxonomy management page, I should stay in Seven, and if I started from a term view page, I should stay in Garland? That would seem to be impossible to implement.
Comment #7
aspilicious commentedI confirm this...
Comment #8
Bojhan commentedWell that is what you want, isn't it. What you are now coming across is the behavior by core that makes sense, its not the most favorable.
Comment #9
aspilicious commentedEditing a taxonomy term is something you only do in admin or am I wrong??? So why does it jumps to Garland then? Im prety confused with this topic...
Comment #10
Bojhan commented@aspilicious No, ofcourse not - it could very well be that editors terms is something you want your editors or registerd users to do :)
Comment #11
aspilicious commentedIt's like editing a page or article, this also brings you to the seven theme...
I don't see the difference?
Comment #13
Anonymous (not verified) commentedBad bot! Didn't anyone ever teach you that we don't break other people's toys?
Comment #14
jhodgdonIn my opinion, editing and adding new Taxonomy Terms should give you the same theme, and it should presumably be Seven if you have the "edit using the admin theme" check box checked, and Garland if you don't. Isn't that how adding/editing content works?
(fires up test box and tests this)
Yes. The check box says "Use the administration theme when editing or creating content". It behaves as follows:
- If it is unchecked, I get Garland on node/add, node/add/(type), and node/#/edit pages.
- If it is checked, I get Seven on all of those.
This seems like the behavior for nodes.
Taxonomy should work the same way. Currently:
- Unchecked: Seven on admin/structure/taxonomy, Seven on add/edit/list vocabulary, Seven on add new term, Garland on edit existing term. Should be Garland for add new term, to be consistent with Nodes.
- Checked: No change in behavior. Should be Seven for both add/edit taxonomy term, to be consisten with Nodes.
Thoughts? Can we fix this?
Comment #15
jhodgdonI looked into fixing this.
There's a variable called 'node_admin_theme' that is set on the Appearance admin page if you check the box. Poor choice of names if it's really to be used consistently for editing other stuff, but so be it.
That variable is only used in two paces in the code currently:
- http://api.drupal.org/api/function/_node_custom_theme/7 - this is used as the theme callback for several paths in http://api.drupal.org/api/function/node_menu/7
- http://api.drupal.org/api/function/system_init/7 (the first couple of lines where it puts in the admin CSS if necessary).
So if we want this to also work consistently with Taxonomy, I think the thing to do would be to move _node_custom_theme into the system module (which is where the Appearance page is, and obviously the function would need to be renamed), make the system_init check there more generic, and then put this theme callback function on the add/edit taxonomy term paths in the Taxonomy module.
I'll try to work up a patch in the next day or two, unless someone beats me to it.
Comment #16
jhodgdonOne more note, here's the form function that defines the variable: http://api.drupal.org/api/function/system_themes_admin_form/7
Comment #17
jhodgdonHere's a patch that uses the content editing theme when editing/adding taxonomy terms (i.e. it does the same thing as node editing - either using the default theme or the admin theme, depending on what option is chosen on the Appearances page).
Comment #18
effulgentsia commentedWith the exception of below code review, I'm +1 for this patch with respect to its implementation, if there's agreement about the UI decision to treat adding/editing taxonomy terms as "content" with respect to the "Use the administration theme when editing or creating content" setting.
As to that UI decision, it fits with the way I think about taxonomy, but for me, there remains a WTF, which is why is "taxonomy" part of "structure" (i.e., on the "admin/structure" page), and if adding a taxonomy term is to be thought of as content rather than "admin", then why is the path for it "admin/structure/taxonomy/VOCABULARY/add"? So my concern is that a UI decision has already been made that taxonomy is structure rather than content, and unless we're revisiting that decision, then this might not be the right solution.
Please remove this. Theme callbacks should only return overrides of defaults and let the theme system manage the default.
I'm guessing the intention was to add a test, which I recommend doing, but I don't see the added test in this patch.
I'm on crack. Are you, too?
Comment #19
jhodgdonEither way:
- We can go with the above solution, which makes taxonomy behave like content.
- Or we can make taxonomy behave like menus, blocks, and the other pages that are in structure: stay in admin theme when editing.
- What I'd like to avoid is the current state of affairs, which is a mish-mash (see #14 above for complete description).
Comment #20
effulgentsia commentedYes, I agree. If taxonomy is content, we should refine #17. If taxonomy is structure, we need to roll a patch that uses the admin theme when editing a taxonomy term. What's currently in HEAD (admin theme for adding and default theme for editing) makes no sense.
Comment #21
effulgentsia commented.
Comment #22
effulgentsia commentedsorry for all the spam. makes sense to change "component", however.
Comment #23
effulgentsia commentedThinking about this a little more, it seems the UI decision has already been made: taxonomy is structure not content (since it appears on the "admin/structure" page), and if there's desire to change that decision, it should be a separate issue. This issue is about the inconsistency between "add" and "edit". This patch fixes that to make "edit" work like "add". It's a simple change that does not need a test, as the functionality having a menu callback use the admin theme in this way is already tested for the "admin" path. Input from usability folks is probably still a good idea though, so leaving those tags.
Comment #24
effulgentsia commentedThis one includes a code comment.
Comment #25
jhodgdonThis patch works for me, and I am happy with the approach. I would go for RTBC.
I still think we need a usability review, however, to verify that it's OK to switch into the admin theme if you are on the taxonomy term viewing page and click on "edit", and that it shouldn't behave the same as content.
Comment #26
David_Rothstein commentedI think this page probably needs to be added to hook_admin_paths() as well, at least until something gets done to unify those approaches at #669510: Merge administration theme with hook_admin_paths()...
Comment #27
jhodgdonThat sounds like a good idea. I hadn't heard of http://api.drupal.org/api/function/hook_admin_paths/7
Is it actually being used anywhere?
Comment #28
David_Rothstein commentedYes, system module uses it for all pages under admin/ by default, and other modules (e.g. node module) are using it too when necessary.
BTW, an issue surrounding that which you might be interested in :)
#651586: Improve the API documentation for hook_admin_paths()-related functions
Comment #29
jhodgdonOK, now I'm even more confused...
David: can you provide a patch to clarify what is supposed to be done here?
Comment #30
andypostAlso there's an issue about breadcrumbs #576290: Breadcrumbs don't work for dynamic paths & local tasks
Comment #31
David_Rothstein commentedI think just this is all that is needed.
The way it goes is that any page which uses the administration theme should (by definition) also be labeled an administrative page, but the converse is not necessarily true, since some pages (e.g. node creation) always have an administrative functionality but don't make sense to show in an admin theme to all users on all sites. Yes, it's a bit crazy - which is why we need to fix it in the other issue, to make Drupal's admin theme feature more flexible :)
Comment #32
effulgentsia commentedAdded a comment.
Comment #33
jhodgdonSo the idea is that with this patch, all Taxonomy term/vocabulary editing should drop you into whatever you've set as your admin theme, right?
I think we need a test... I did test this out manually and it's working:
a) Clean install with Minimal install profile.
b) Enable Taxonomy.
c) Visit Appearance, and set Seven as admin theme (left Garland as the main theme).
d) Try out various pages:
- Add vocabulary with machine name "test_vocab": Uses Seven theme - admin/structure/taxonomy/add
- Edit vocabulary: Uses Seven - admin/structure/taxonomy/test_vocab/edit
- List terms: Uses Seven - admin/structure/taxonomy/test_vocab
- Add term: Uses Seven - admin/structure/taxonomy/test_vocab/add
- Edit term: Uses Seven - taxonomy/term/1/edit
- View term page: Uses Garland - taxonomy/term/1
So it appears to be working as planned. Perhaps the above sequence could be used to make a test?
Comment #34
andypostI think that only a term edit should be changed, vocabularies are part of system.
+1 for test
Comment #35
jhodgdonandypost: What are you saying? Only term editing has been changed. Previously adding a term gave you the admin theme, and editing didn't. With this patch, both give you the admin theme (the current behavior is in #33). Do you think the current behavior is incorrect?
Comment #36
andypostjhodgdon: I mean that vocabulary add/edit/del should stay in admin/* as it is now but only term add/edit/del operations should be affected by settings in Appearance
Comment #37
jhodgdonandypost: The "use admin for content editing" setting is not being used for this patch. See #23 above.
So the only setting in Appearance that has an effect here is the choice of "what is my admin theme". This affects everything in Admin (not just taxonomy), as well as now the edit taxonomy term page.
Comment #38
andypostjhodgdon: I just commented your #33
Only taxonomy term edit is affected by this patch
Also I ask about term delete theme.
Comment #39
jhodgdonRight, only taxonomy term edit is affected by the patch. All the other taxonomy operations were already using the admin theme.
Term delete appears to be part of the term edit path, so it is also changed to using the admin theme with this patch.
Comment #41
vosechu commentedI'm at the Drupalcon sprint so I'm going to try to build these tests. If you want to work together let me know in #drupal
Comment #42
vosechu commentedTesting this is a little too intense for me right yet. If this still exists at the end of the day I'll get some more help and try again
Comment #43
iLLin commentedIm at the sprint and I'll give it a go.
Comment #44
iLLin commentedI have added a test case that checks to see if the admin theme switches correctly when adding a taxonomy term, to editing a taxonomy term. I needed to inject a meta tag (this could be done another way) but I had to add the current theme to the page somehow. I created a module to go along with this test as something was needed to fill this gap. The patch is for taxonomy.test and the module is standalone. The script will enable it during the test. Is there a better way to inject/extract the current theme from the page?
Comment #45
iLLin commentedJacked up my refactoring. New patch added.
Comment #47
iLLin commentedIt's gonna fail until the patch for the admin theme on edit is applied. And the added module is enabled, not sure on how else to present this. Let me know if something needs changing.
Comment #48
iLLin commentedComment #49
iLLin commentedFixed the file name.
Comment #51
iLLin commentedI can add a wrapper that will fail out if the module isn't present or turned on, but I didn't know if this is the best way to handle it. That is where the notices is coming from as $matches[1] isn't set. Let me know.
Comment #52
jhodgdonCan't you put all the changes you need for the tests into the same patch, so that the patch will pass the tests? We can't commit the patch until all the tests pass.
Or am I not understanding why these tests are failing?
Oh. You need to put the fixes from the patch in #32 above into your patch too.
Comment #53
iLLin commentedThis patch is a test on the patch submitted here. Another reason its failing is I had to create a module that injects the theme name into a meta tag so I could scrape the html output to actually verify that the theme did in fact change on these pages to the admin theme.
That make sense? It's kinda funky but I don't know another way to do this, I am open to suggestions.
-Dennis
Comment #54
jhodgdonWhat we're looking for is 1 patch that contains the fix and the test, please. And if your test requires a module, include that in the patch please. Many existing tests already do that...
Are you at Drupalcon? If so, come down to the coder lounge sometime and we can discuss this...
Comment #55
iLLin commentedNew patch added with all relevant information.
Comment #56
iLLin commentedComment #57
jhodgdonThere -- looks like a complete patch this time!
The tests you have added look excellent! Your coding style needs a little work though. See
http://drupal.org/coding-standards
for reference.
a) In-code comment style -- http://drupal.org/coding-standards#comment -- all of the comments in the test need to be edited for style (start with capital letters, end with period, space between // and the comment text). Several of them also have some grammar problems that make them somewhat unclear. If you need some help with the writing, just clean up the formatting and someone else (such as me) can help with the rewriting.
b)
I think this would be clearer as:
c) The doc comment for the test class should not use OR but instead just "or". Also, it should start with /** rather than /*:
d) The methods other than setup and getinfo in your test class need to have doc blocks. See http://drupal.org/node/1354#functions for doc on how to write these. Also, the two methods that you did document do not follow the doc standards.
e)
This is misspelled. Also, we now say "Implements hook_foo()." for hooks in D7. Check the doxygen page in (d) for more information.
Comment #58
jhodgdonI also had a comment on the code in taxonomy.module, or rather a question:
Is it actually necessary to do both:
in hook_menu()
as well as
It seems like one or the other of them should be enough?
Comment #59
iLLin commentedI will verify this authors patch as I just applied their work to my checkout and made a complete patch. I will get my documentation up to D7 standards.
Comment #60
iLLin commentedNew patch added. I cleaned up the documentation and verified the authors patch. Removed his commenting as I don't think its needed in core modules? (Commenting in hook menu). Hopefully my commenting is better :).
Anyway to clarify the original authors patch, Yes you do need both spots. In hook_menu() he added the theme callback to display the admin theme when on the edit page for a taxonomy page. The hook_admin_paths function adds the same path to the overlay popup. So both spots are needed. The reason the "add" portion wasn't affect is its pre-pended by the path 'admin/structure...' etc and I think those paths are handled differently.
-d
Comment #61
gowriabhaya commentedCode sprint tag
Comment #62
timcosgrove commentedConfirmed that this patch
- keeps both adding and editing a taxonomy term in the admin theme, regardless of the setting of admin theme with respect to editing content
Comment #63
nonsiePatch is good to go
Comment #64
dirtabulous commentedWhen editing a term, the edit term screen in the Seven overlay works as expected as long as Clean URLs enabled. If clean URLs are disabled, when you click edit on a term, the edit screen is displayed in Seven, but not in an overlay.
If the above issue isn't part of this, please set the status back and I can issue a new bug report.
I was testing this patch because I found a similar issue when returning from the Edit of a Term. This works as expected with clean urls enabled, but would return a Page Not Found error in Seven overlay when disabled.
Comment #65
iLLin commentedI would log this as a new bug report as this does the same thing for node edit when you edit from the content listing page.
-d
Comment #67
Georg commented#60: taxonomy_admin_theme-678592-60.patch queued for re-testing.
Comment #68
klausino newline at the end of file
Powered by Dreditor.
Comment #69
David_Rothstein commentedLet's get this one in.
The previous test was a great start, but it also seems like a lot of code to add for what is a pretty small thing to test :) If we're going to search through the rendered HTML for an indication of what theme was used anyway..... then rather than injecting something specific it's probably simpler to just look for a CSS file from the theme (a technique which is already used in other tests we have in core).
Since the previous patch still needed some work for code style, etc, anyway and hadn't been worked on for a number of months, I decided to reroll with this simpler approach for the test.
Comment #70
Jeff Burnz commentedsub
Comment #71
jhodgdon#69: taxonomy_admin_theme-678592-69.patch queued for re-testing.
Comment #72
bdunwood commentedsub
Comment #73
effulgentsia commented#69 looks great.
Comment #74
dave reidAre we missing the term add and delete pages? As well as vocabulary add/edit/delete?
Comment #75
jhodgdonThe whole point of this issue was to unify term add and term edit -- they are currently not the same (add uses admin theme, but edit doesn't).
I believe that vocabulary add/edit/delete, and taxonomy vocab/term delete, are all already using the admin theme, but someone could check that.
Comment #76
dave reidYeah brain fart, I forgot those cases are already under admin/*...
Comment #77
webchickThough technically this violates UX freeze, I think the WTF factor here of jumping back and forth is pretty significant.
Committed to HEAD. Thanks!