Needs review
Project:
Context Reaction: Theme
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Sep 2010 at 19:40 UTC
Updated:
15 Sep 2015 at 05:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Jackinloadup commentedPlease see #786900-26: Drupal 7 Port for information about the Context D7 port.
Comment #2
jerrac commentedSo, Context itself has had several alpha releases for D7. Is this module going to get an update? Or does the new version of Context provide the same functionality?
Comment #3
real_ate commentedAny word on this port? Now that context is on beta-1 the API won't (shouldn't) change and it is well into the right time to create a port. Has any work been done on this yet?
Comment #4
chaosmind commentedbump, subscribe, +1... etc.
Comment #5
jlyon commented+1. In the meantime, themekey has a D7 release: http://drupal.org/project/themekey.
Comment #6
jlyon commentedI created a sandbox project, and made some progress with the upgrade, but ran into a stumbling block.
http://drupal.org/sandbox/jlyon/1290746
git clone --branch master jlyon@git.drupal.org:sandbox/jlyon/1290746.git context_reaction__theme_7_x_1_x_dev
------
This is a clean upgrade of the D6 version of this module. All of the context-related functions work, however, I cannot get Drupal to listen to the value of $custom_theme (set in $plugin->execute, called from the hook_init()).
I also explored using hook_custom_theme(), like themekey does, however I was unable to get the plugin to load from this hook. It seems like it is called earlier in the bootstrap process than even hook_init().
Are there any more ideas out there?
Comment #7
minoroffense commentedMaybe the module weight would help.
Comment #8
xiong commentedany news?
Comment #9
Alumei commentedI spend some time looking into this, as i wanted to use this module in conjuction with context, on my drupal 7 site.
hook_custom_theme() is indeed called before hook_init(), hence no context is initialised at that point.
Also it seems that there is no way to change the theme in hook_init, as the theme has already been initialised by drupal_theme_initialize() earlier in bootstrap.
ThemeKey seems to be working with hook_custom_theme() because it does all it's condition checking within hook_custom_theme().
Comment #10
Alumei commentedIt seems that the theme could be set, if the following happens in hook_custom_theme:
Comment #11
Alumei commentedI made a patch against the sandbox version mentioned above.
The solution is not ideal, but working.
Comment #12
jorditr commentedHi, I'm not a coder and I have no access to GIT.
Brinbellomy, jlion, Alumei, or someone else, would you mind to upload as an attachment a version of the module in d7 version to be able to test and apply the patches :-)
I'm very interested on using that module, all my last sites relly on Context and that is a very desirable feature eagerly missing on it! Thanks to all in advance :-)
Comment #13
lahode commentedYeah, it worked awesome, thanks!
To answer to JordiTR, here is the geek recipe...
Type on linux shell, the following lines:
git clone http://git.drupal.org/sandbox/jlyon/1290746.git context_reaction__theme_7_x_1_x_dev
wget http://drupal.org/files/context_reaction_theme-port-to-D7-920990-11.patch
cd context_reaction__theme_7_x_1_x_dev
git apply -v http://drupal.org/files/context_reaction_theme-port-to-D7-920990-11.patch
rm context_reaction_theme-port-to-D7-920990-11.patch
Comment #14
jorditr commentedThanks a lot lahode. I told you I was not a coder (although I code small things) ;-) moreover I don't use Linux :-P
Anyway, I work with netBeans and your suggestions has inspired me to use several functions on it to git the sandbox module and then apply the patch :-) Thanks to both.
Comment #15
jorditr commentedHi, I've installed this build and it works properly, beautifully!! I should say :-)
But, it displays a warning on my system on every single context I enter in to edit (except if that context has set a reaction for theme change):
and it's pointing to "'#default_value' => $settings['theme']," on the $form array of "function options_form($context)".
Just to try to avoid any confusion here is how that function looks on my build on "plugins/context_reaction_active_theme.inc":
Any idea?
Comment #16
jlyon commented@Alumei: Thanks for the patch. I finally just applied it to my git sandbox project at http://drupal.org/sandbox/jlyon/1290746.
@JordiTR: It looks like you must not have set a theme in the context administration interface. Could that be? The error is saying that
$settings['theme']is empty.Comment #17
jorditr commentedYes, that's right, but most of the context don't have each and every reaction set and don't complain :-)
I have not written the code, I just ask if I applied the patch correctly and others are having or not the same behaviour.
Comment #18
jorditr commentedI've been experimenting with "Context Reaction: theme" converted to Drupal 7 in order to make it compatible with "Context Mobile Detect" on that thread: http://drupal.org/node/1792868
Comment #19
kpa commented@JordiTR: replace line 28
'#default_value' => $settings['theme'],
with:
'#default_value' => isset($settings['theme']) ? $settings['theme'] : '',
It's a non-critical bug and this will fix.
Comment #20
jlyon commentedThanks kpa, I just updated the sandbox project: http://drupal.org/sandbox/jlyon/1290746.
Comment #21
kpa commentedIt may also be an idea to add a module_invoke into the hook_custom_theme implementation to allow other modules (with custom plugins) the ability to run their conditions prior to active_theme being called.
At present this will only run conditions from the path, language and user context conditions - is there a reason for limiting this?
I had to add:
into context_reaction_theme_custom_theme() to get my custom condition to load..
Other than that - great module - and saved me a lot of time (and the MASSIVE overhead of the themekey module). Thanks.
Comment #22
jorditr commentedThanks kpa (Phillip), I wrote something similar to keep my site from warning each time I use context :-)
I was not sure if that was the proper way to do it, because I looked how other context complement modules solve this and some use that approach and other I'm not capable to understand if the are doing something different. Anyway, your proposal works efficiently :-)
Comment #23
jorditr commentedRegarding that point look how I had to face exactly the same solution for being able to change theme when using "Context Mobile Detect" on #18.
Context family of module provide a huge range of possibilities. Combining "Context Mobile Detect" with other Context complements (add assets, disable context, ssl, session, overlay, get, geo ip, http headers) open a real solution for Mobile webs with Drupal (specially 7) using Context as the central tool. I'm not sure how solid it is, but all my testing has been quite promising until now. By now only 24 sites are registered as using "Context Mobile Detect" :-)
Comment #24
Anonymous (not verified) commentedChanging the title so it's easier to follow in global issue queues.
Comment #25
jorditr commentedI find very weird that the port proposed here for that module to Drupal 7 is working perfectly and it has not received any attention from the maintainer. I got it perfectly working with the mentioned "Context Mobile Detect" and even I proposed a patch that has not been reviewed... Well...
Comment #26
Anonymous (not verified) commentedIt appears that the project has been abandoned by its former maintainer.
There's an official drupal.org process for taking over an unmaintained project. It's quite straightforward, so if you are willing to take the module forward, you might want to step up and do that!
Comment #27
Michsk commentedHere's 'my' version of the D7 port... Really have to get started with git. The zip contains the whole module.
Basically:
- it has some sort of 'auto finding' all the conditions
- use the themes info['name'], so we show the theme name with captions where it should
- small tweak in #default_value for the themes select list
Comment #28
justadropofwater commentedThis unfortunately is not switching the theme based on 'path' or 'user role' contexts and produces a Missing Argument Warning. I'll try to find some time to debug...
Comment #29
kpa commentedHi all, just a brief update note to say that (finally) I'm getting round to sorting this out. I've been using this module on a D7 site since September with no problems, and I'll be reviewing everyone's contributions above over the next week or so. Hoping to get a 7.x-dev by the weekend... watch this space :)
Comment #30
damienmckenna@kpa: Any updates?
Comment #31
eric_a commentedThere's D7 code in 7.x-1.x (http://cgit.drupalcode.org/context_reaction_theme/commit/?id=9e119e080b3...).
Has anybody tried this?