For now, as documented in #988208: What's the best way to make the existence of a region (left, first, for instance) a context?, regions only seem to be shown for the active theme. For example, if I use a zen-based theme (which uses the "first" region) as my main theme and Garland (which uses "left"), editing a context doesn't show me "left".

I would suggest, rather than showing the list of the regions on the default theme, showing something like:

  • left (in Garland, Pushbutton)
  • first (in Zen)
  • ...

And allowing users to put blocks in any of those regions. Going further, why not allow users to add regions which are not even in the current site's active themes? Thus, if I'm developing a Feature on Garland, but I know it will be used on site with a zen-based theme, I don't have to have zen installed in order to set a block to appear in the "first" region.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alberto56’s picture

Version: 6.x-3.x-dev » 7.x-3.0-beta1
Status: Active » Needs review
FileSize
33.72 KB
2.95 KB

Here is a patch against the 7.x version. In the attached image, you can see that the regions for bartik, seven and zen are visible in the blocks reaction for my context. I tried using a single context to define blocks in regions in various themes, and it works for me.

alberto56’s picture

Version: 7.x-3.0-beta1 » 7.x-3.x-dev
Marko B’s picture

Will this be ported to D6 also? I have same problem there.

xjm’s picture

caschbre’s picture

I love context and have found myself in situations where a client wants to make several themes available to their users. Context breaks down for me at this point. I would love to see capabilities to add blocks to regions for (at least) active themes if not all installed themes. And as mentioned... going a step further and simply adding blocks to regions that may or may not exist for use in features, etc.

I would love to see something like this in D6 and D7.

I would suggest, rather than showing the list of the regions on the default theme, showing something like:

  • left (in Garland, Pushbutton)
  • first (in Zen)

Might I suggest an alternative to this. The issue that may come up is Garland and Pushbutton not using "left" in the same way. Or maybe we want to put a block in Garland->left but not Pushbutton->left.

There are at least three possible use cases for this... (in no particular order)

The first being a condition is created to test what theme is active. The reactions would still have to have some UI to allow for selecting regions by theme to add blocks to. This could also lead to a lot of conditions.

The second being multiple 'add block' reactions for a condition. Each 'add block' reaction would be for a different theme.

The third being a single 'add block' reaction with some UI that allows the admin to add a block to a region for each theme.

alberto56’s picture

@caschbre

you've made some good points, and here are my thoughts:

(1) Long term, I think it would be a good idea to somehow standardize region names in Drupal. See #1136436: Standardize region names based on popular contrib theme patterns

(2) I would argue against making it possible to create arbitrary regions. If one wants to create a develop a context for a given theme, just install and enable that theme on your development site, and use something like the patch in #1. The confusion of allowing users to add blocks to non-existant regions is not, I believe, justified by the added convenience.

(3) I like your idea of having a "condition [...] to test what theme is active", and also I prefer a single "add block" reaction as opposed to several (it's just simpler to use, I think).

Thoughts welcome, thanks.

Albert.

Marko B’s picture

I just added missing regions to active themes info file and solved this problem that way.

timaholt’s picture

This might be a crazy idea but what if the reaction pane had tabs across the top of it - one for each enabled theme? That would make the ui make sense, and also you could apply any reaction to any theme. You could even have an "All" tab that would pre-populate reactions in all the individual themes, including blocks (similar to how admin/build/block works). Then you could override/tweak the reactions per theme if you wanted, or keep the default 'all' behavior which is essentially how it works right now.

el_reverend’s picture

trimsyndicate. That sounds like a good plan. And adding missing theme regions to a theme might be a good way if you, the developer are also maintaining the site, however fails when you have content maintainers that do not know how to manipulate a theme (not that you want too many cooks in the kitchen).

artkon’s picture

Version: 7.x-3.x-dev » 6.x-3.0
FileSize
1.68 KB

I applied the patch to d6 version 3, pretty sure its working now displaying all regions of all themes.

alberto56’s picture

Version: 6.x-3.0 » 7.x-3.x-dev

@artkon, thanks, however I will change this back to 7.x-3.x-dev, as, even though the patch may work on 6.x, this should be fixed first in 7.x and then backported.

artkon’s picture

For my previous patch(up), had some constants (REGIONS_VISIBLE, REGIONS_ALL) that are not part of D6 so switched them to the appropriate strings.

windmaomao’s picture

thanks @artkon, really great.

my question is that currently only the regions that exists in the currently activated theme is shown, regions with different name in another theme is not shown for some reason. Can anyone confirm that ?

windmaomao’s picture

i guess, this bug might have something to do with Context layouts module, because when I select different layout, the region name list changes.

windmaomao’s picture

Maybe we need to add a function to determine what is our currently selected theme to work with first. Then the rest of the functionality (ex. context layout, region list) will just follow. The module Context Reaction Theme might be integrated into Context module so that the current selected theme function can be accessed.

DamienMcKenna’s picture

How about just highlighting the default theme by making the them name bold?

jonloh’s picture

Status: Needs review » Reviewed & tested by the community

Works great for me. It should be included into the Context module.

Nitebreed’s picture

+1 for including this patch

nadavoid’s picture

Just used this patch for the first time. It works great, and is very useful for sites that are using multiple themes.

havran’s picture

This is useful. +1 for commit.

davidwatson’s picture

Reviewed the D6 version of this, looks solid. +1 to RTBC.

yorkshire-pudding’s picture

Has this patch been incorporated into the latest release (7.x-3.1)? If so, I can't seem to get it to work, and some of the lines from the patch don't match up to what is in the file, so I assume the patch is not valid for the current release.

Thanks
Martin

colan’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

I think the D7 one needs a re-roll:

patching file plugins/context_reaction_block.inc
Hunk #1 FAILED at 58.
Hunk #2 FAILED at 214.
Hunk #3 FAILED at 254.
Hunk #4 FAILED at 289.
Hunk #5 FAILED at 321.
Hunk #6 succeeded at 675 with fuzz 2 (offset 39 lines).
5 out of 6 hunks FAILED -- saving rejects to file plugins/context_reaction_block.inc.rej
alex.skrypnyk’s picture

Status: Needs work » Needs review
FileSize
5.09 KB

Re-rolled patch for D7 from #16 against 7.x-3.x-dev (61bf8909d3d99999397e937f15aefe1e7b683510)
Works perfectly together with context_omega in production.

8thom’s picture

Added a simple sandbox module that adds all active regions from all active themes to the default theme for use in context.

https://www.drupal.org/sandbox/8thom/2321193

alex.skrypnyk’s picture

Path in #24 works in production for the last 6 month. Someone, please review so we can get this one committed.

gmaxime’s picture

#24 worked for me (Context 7.x-3.6). Thank you

Nitebreed’s picture

Status: Needs review » Reviewed & tested by the community

The last submitted patch, 10: show_all_regions_in_ui-988222-10.patch, failed testing.

The last submitted patch, 1: 988222-1-show-all-regions.patch, failed testing.

The last submitted patch, 12: show_all_regions_in_ui-988222-12.patch, failed testing.

The last submitted patch, 16: context-n988222-16-d7.patch, failed testing.

The last submitted patch, 16: context-n988222-16-d6.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: context-n988222-24-d7.patch, failed testing.

aitala’s picture

This patch appears to work in version 7.x-3.9 of Context. Can anyone else verify?

Eric

aitala’s picture

This patch appears to work in version 7.x-3.10 of Context. Can anyone else verify?