Needs review
Project:
Sections
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Reporter:
Created:
15 Jan 2010 at 14:27 UTC
Updated:
25 Oct 2012 at 16:55 UTC
Jump to comment: Most recent file
When I try to change the theme directly in the edit page of a node, the assign node theme module don't work. The theme don't change and I have the admin 1 role.
Must I change something in the section that I want to assign to my node ? checkboxes ?
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | 685736.29-sections-nodetheming-precedence.patch | 613 bytes | mrfelton |
| #29 | 685736.29-sections-nodetheming-precedence.patch | 785 bytes | mrfelton |
| #23 | nodetheming_precedence-685736.patch | 957 bytes | callison |
| #17 | sections_node_switch_fails.patch | 5.48 KB | hass |
| #15 | 685736-sections-node-section-override-preview-revisions.patch | 611 bytes | mrfelton |
Comments
Comment #1
hass commentedWhat is "node theme module"?
Comment #2
pixelpreview@gmail.com commentedsorry it's not a module but a functionnality
I have this in my edit page
".. theme configuration
This setting allows you to create a section per node. A node section will get the highest weight and take precedence about all other inheriting sections.
Select theme : ( a menu list of my themes )
Select the theme you want to use for this node. Disabled themes are not used until they are enabled on themes page.
.."
and in permissions page, I see that :
module sections
> administer sections (checkbox)
> assign node theme (checkbox) <-----
I think that's that functionnality "assign node theme" that I see in my edit page no ?
Comment #3
hass commentedThis must work, but it's a new sections feature.
Wether the selected theme is disabled or i don't know. You need to debug. Have you upgraded from earlier version? Make sure you run update.php. Are the node theme setting kept? Keep in mind thatonly the node view may change.
Comment #4
pixelpreview@gmail.com commentedthe selected theme is not disabled because I use it with the section module to assign it to some paths and it works without problems
It seems that these functionnality has no effects on my node when I try to assign a theme directly in the node
The section module works but not these function certainly a conflict with an another module
thanks for your feedback
Comment #5
hass commentedHave you found out the reason?
Comment #6
pixelpreview@gmail.com commentedno and I use only section module
These function doesn't work and actualy I don't have found the solution
My site is a portal with 10 sections and 10 subthemes in css I think that the problem is perhaps here
a conflict in the weight of a theme ? I don't know
Comment #7
hass commentedCan you try the next DEV, please? Enable the new debugging setting and go to your failing node to see what's going on. Come back with the debugging information, please.
Comment #8
mrfelton commentedIf a node matches the path spec from a sections_data definition AND has a node specific theme definition, the sections_data definition will take precedence. I think this is the wrong behavior.
Node specific theme definition should override other sections definitions.
I think this happens because the sections_data theme switching happens in hook_init.
init_theme() can only be called once.
So, if hook_init() switches the theme, then the node specific theme switching in hook_nodeapi doesn't work.
Comment #9
mrfelton commentedComment #10
mrfelton commentedHere is a patch.
Rather than using nodeapi, it's all done in in hook_init.
If you are viewing a node, then it checks to see if the node has a specific theme selection, and if so it applies the theme and returns.
If no theme was found, or you were not viewing a node, then the defined sections are checked.
Comment #11
mrfelton commentedHere is one without the typo in the comment too!
Comment #12
hass commentedBlocking release
Comment #13
hass commented@mrfelton: Does
if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {work if the node have an alias? I guess no, isn't it?Comment #14
mrfelton commented@hass - yes, it does. It is a very standard way of checking if you are on a node view page.
Comment #15
mrfelton commentedHere is an enhancement version that caters for node preview and revisions pages
if (arg(0) == 'node' && is_numeric(arg(1)) && ( !arg(2) || arg(2) == 'preview' || (arg(2) == 'revisions' && arg(4) == 'view') ) ) {Comment #16
hass commentedThis cannot work in a general manner. Code need to move into _sections_in_section() or it does not return a node specific theme if other modules like to know the section they are in.
Comment #17
hass commentedNew patch for review.
Re #15: I see your point for this, but it's not the standard core way, therefore left this out.
Comment #18
mrfelton commented@hass, checking arg() is the standard core way of checking if you are on a node edit/view page. Core doesn't have any situations where it needs to check if you are viewing a revision, and so it never does
(arg(2) == 'revisions' && arg(4) == 'view') ). But, we do need to do that check, because unlike core, we do need to do something specific if people are looking at the node revisions tab - we need to switch the theme there if appropriate. Otherwise, it is not possible to view your revisions with node specific section overrides.Comment #19
mrfelton commentedNote that I also included checking
arg(2) == 'preview', however, node/*/preview is not really a standard path (unlike node/*/revisions/*/view) - I have a custom module that alters the node preview button, so that it pops up the preview in a new browser tab, and a custom mennu callback that is able to show the node preview at the url node/*/preview. I'd accept leaving that part out, since that only applies in my situation (with my custom module installed). However, the revisions things is a standard path, that is part of the drupal core, and I really think that node revisions should be shown in the correct section theme.Comment #20
hass commentedHm... other modules may also show a tab in a node... for this case we need to change to
if (arg(0) == 'node' && is_numeric(arg(1))) {. But over all it may be bad, too as the administration theme for edit tab is not working... very bad... endless collisions... but we could argue that this is a negative side effect that is at least acceptable here.We need to rethink if the node part should not better be rewritten and all sections_nodes table data move into to sections_data to make this more generic. In this case the path's become configurable like all other sections path's, too.
Something we could keep in mind and fix in the next version.
Comment #21
hass commented#18: I may was unclear what I'm talking about... in core we have this feature named "Use administration theme for content editing". I tried to replicate this in sections, but here it fails. We cannot add all possible arguments and verify them, this is why we may need to stay with #20 for now.
Comment #22
hass commentedI don't like my patch. I will rewrite it and add all node themes to the old sections_data table. This will reduce complexity and allow changing the path filters for node themes, too.
Comment #23
callison commentedSince there's been no action on here for several months, I thought I'd go ahead. First, a couple of thoughts:
I've created a new patch here and what I've done is simply add a little section in hook_init that checks if the current node (if we're on a node) has a theme setting and, if so, doesn't allow the section theme to load so that hook_nodeapi can load it later. Therefore this fixes the problem at hand (including hass' thoughts about previews, revisions, etc) and does not change the way the module works (which, IMO should be saved for another issue). I'd be interested in your feedback.
Comment #24
hass commentedThis is like mfeltons and break in many ways. It's tooo simple.
Comment #25
callison commented@hass: Can you please explain how it breaks? Thanks.
[Edit] I understand what you were saying in #16, but couldn't we then just add an (almost identical) section of code (or a new function or something) in _sections_in_section() that will check if we're on a node and return that node's theme settings if they're available? What I was understanding about your patch is that it is trying to change the whole way this module handles the node theming (using the node caches and stuff) and that seems unnecessary to me. Please give me your thoughts. Thanks.
BTW, I'm not saying that your approach is bad - just IMO it's not a necessary change for now and should be integrated into a next release or something instead of as a fix for this patch. Just a thought. Let me know what you think.
Comment #26
hass commentedIf someone have configured to show node edit pages with admin theme it will break. There are several details that also not working for many other people.
Comment #27
callison commentedAlright. Well, is there anything I can do that would help get it right? Do you want to provide some use cases or something and talk out a good solution? I'm here to help if you want me.
Comment #28
mrfelton commentedDont think you should be calling node_load in hook_init.
Comment #29
mrfelton commentedHere is the same patch as #23, but doing a simple db look up in hook_init instead.
Comment #30
mrfelton commented