Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
theme system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2009 at 01:42 UTC
Updated:
28 May 2009 at 11:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
johnalbinThis patch won't work until #367299: Update and polish default page.tpl.php and associated css lands. And will probably also cause a bunch of simple test errors. :-p
Comment #2
johnalbinThis patch modifies system_theme_default() and effectively removes the old "content" region and adds:
It adds those regions to system.module's, Garland's, Bluemarine's, and PushButton's page.tpl.php. I left Chameleon alone since it only ever provided left/right regions.
Testbot says…
Comment #3
robloachSubscribing, I'd love to take a look at this today......... We might be able to move how comments are rendered below the content to this new content_bottom region.
Comment #4
kika commentedThere will be $content->$content_bottom update path, verdad?
Comment #5
johnalbinOh! Oops. This patch does not have the content to content_bottom hook_update. Anybody want to help add it?
Comment #6
dries commentedComment #7
ultimateboy commentedCross referencing #107794: At least rename the 'content' region to 'below content'.
This issue was also found in UBUserTesting2009, so tagging and referencing: http://www.drupalusability.org/node/10
Comment #8
yoroy commentedone more tag…
Comment #9
ultimateboy commentedComment #10
ultimateboy commentedAdded the update function.
Comment #12
ultimateboy commentedThis seems to apply just fine for me.. I'll give it another shot.
Comment #13
robloachAre you trying ton replace the content region with content_bottom and content_top, or just add content_bottom and content_top? It seems a bit inconsistent here. In some cases you're replacing, in some cases you're adding bottom and top.
I think it would be logical to add the content_top and content_bottom regions. Either that or come up with a better weighting system for objects that are being added in the regions.
Comment #14
ultimateboy commentedI dont quite understand what you are talking about. This removes the content region and adds a content_bottom and content_top. Can you point me to a specific instance where you believe that the content region is not being properly removed? I have re-tested things and it appears to be working as intended. Until then, lets give the testbot another shot at this.. cause it applies on my end.
Comment #16
xanoIdeally, names should describe purpose, not use cases. $content_bottom tells us something about the case where the region is being used as the bottom part of the content, but what if we want to display it next to the page's general content? (The same goes up for the sidebar regions, but that's not what this issue is about).
Comment #17
kika commentedbefore / after?
Comment #18
robloachSystem.module -- Replace
Bluemarine theme -- Add
Pushbutton theme -- Add
Garland -- Add
Xano at #16 is also correct. We'll have to describe the region rather then state its location. The theme could essentially place the region anywhere, not exclusively at the top of the content.
Also, note that the new drupal_render() gives us even more control over how things are weighted during the rendering process. So, we should keep that in mind before adding a couple regions beside each other.
Comment #19
xanoI haven't really checked out the new drupal_render() and hook_page_alter() yet (which both are relevant as far as I can tell), but kika's before and after make sense.
Comment #20
xanoComment #21
johnalbincrap. gotta run to catch dinner before my flight! but I've got an update patch that fixes system/page.tpl that ultimateboy accidentally tweaked. Thanks for the block.install! You rock! I'm not sure what to do about non-core themes that don't override the default regions; they'll loose their content region blocks.
above/below work for me! :-)
No time to double-check if I borked this. I'll keep my fingers crossed it doesn't fail. And will check back after I land/sleep in Taipei.
Comment #22
ugerhard commentedLet the Bot have a stab at it.
Comment #24
ultimateboy commentedUpdated search test to add the block to the content_below region instead of content. Tests should pass now.
Comment #25
robloachNot sure if this is desired, but:
...... Two different regions with the same 'center' ID?
Comment #26
ultimateboy commentedIn this particular case, I believe this is correct.. both the content_above and content_below regions are being placed within div#center. What you posted in #25 is what is telling simpletest where to look for blocks placed in those regions.. though this is my first real exposure to simpletest, so I could be mistaken.
Comment #27
xanoAbove and below what? Those names don't make sense without a central $content region. If we stick to splitting $content in two, the two new regions should be $content_top and $content_bottom. This is more semantically correct.
Comment #28
robloachShouldn't semantics define the content instead of where this content should be? Top and bottom doesn't really define much, aside from where it should be. Since they are regions, you could essentially stick the content_top below the content_below.....
Comment #29
wretched sinner - saved by grace commentedAs a bit of a Drupal theming newbie, the changes in #18 that Rob is questioning make sense to me.
It seems that we currently have a Content region, into which we can add various blocks. The proposal here is to split that into Content Above and Content Below regions, which flank the main content of the page. As it stands, the block settings page does not allow us to choose which region the main content goes into, and so therefore the Above and Below names do make sence, in that the
$contentis output in between these regions. (As an aside, does anyone else like the idea of having the$contentbe outputtable into a region? Kind of like a mini-panels i guess.)I guess hat I am understanding is that in D6, you can add blocks to the central region (I'm not sure off the top on my head if they display above or below the node content - I'm assuming below based on the upgrade path). What this patch seems to do to me is provide administrators with a bit more flexibilty in deciding whether those blocks appear above or below the main content.
If I have missed the boat on the intention and functionality of the patch, let me know.
Comment #30
xano@#28: True. Both $content_above and $content_top are wrong names from that point of view.
Something else: should this really be in core? This really looks theme-dependent to me.
Comment #31
johnalbinSticking 2 separate items in one variable is bad; it makes it impossible to move stuff around in a tpl override. In this instance, the page’s content and a region are both going into $content. So they need to be split out.
Also, when I asked about creating a "below content" region in #367299: Update and polish default page.tpl.php and associated css and asked if there were any other regions core should have, webchick said “above content plzkthxbi.” http://drupal.org/node/367299#comment-1256172
Comment #33
johnalbinAfter the crufty themes were removed (yay!), the patch no longer applies.
Re-rolled.
Comment #34
skilip commentedsubscribing
Comment #35
sunSorry, but was is $content_top and $content_bottom ? $content is a completely non-descriptive and nonsense variable already; so here we add to this nonsense by adding meta-information (locative information) to "content" (whatever that is).
...now I had a look at the patch and found out that it would have made sense to have a proper description of the goals in this issue.
The separation makes sense, but the naming issue still stands.
Comment #36
ultimateboy commentedI think that the naming of regions should be saved for a different issue. We already have "left sidebar" and "right sidebar" which have locative information. I do not see "content top" and "content bottom" as any worse. Now, with that said, I do agree that locative information should be kept to a minimal, but that is something that should probably be discussed elsewhere, as it is probably going to generate a debate of some sort, as there is no perfect answer.
Comment #37
skilip commentedWill we drop $content's functionality being a region to which blocks can be assigned here? That would be awesome!
Comment #38
gábor hojtsyI've submitted an issue to get the IDs of regions unified: #422738: Improve consistency in base region IDs. It was marked in part a duplicate of this issue (since I've worked with the region IDs there). Reading through the existing comments, I agree that "content" is an unfortunate and ambiguous name. It is how it was in all Drupal versions I knew, and the way we would be able to get out of it IMHO is to make it a "block" so you can weight it as anything else in a region. Then "top" and "bottom" would not make sense, since the "content" itself would be movable among other items. Same applies for footer, where the "footer message" should simply be one block and not a special Drupal setting. After all Drupal supports putting blocks into regions, and reorganizing them, offering the most control over this to the site admin on top of the theme. Then we can just name the region "main" or something (assuming the region covers a major part of the screen, however this is also highly theme dependent), and be done with our job. People would be able to put blocks above and below "content" simply because it would reside in a region as a "block".
I'll look into how twisted it would be to make the content item a block.
Comment #39
gábor hojtsyHere is a patch which is tested to work with Garland and Stark (and assumed to work with Minnelli obviously). I've also tested basic update.php screens (since that is using the maintenance theme), and that also worked.
What I do here is basically at any point someone tries to set the page, I store the page data for a system module block to use (the function used to generate that is named "drupal_get_page()" which both does some metadata generation and renderable content array generation).
The system module block can be positioned however you want it to and stuff can be put above and below it. Obviously if you disable this block, you can easily make damage to your experience, and getting it working again would require digging in the DB. *However* this opens the door to disabling this and only using other block regions on some pages allowing for more flexible layouts when you need to arrange your page in an unconventional way.
For testers: either install your Drupal 7 fresh or uncomment the line where it says UNCOMMENT. Then do what the comment says (enable and position the content block) and comment it out again.
I think having one region where you can order stuff is much more useful then having "top" and "bottom" regions, especially when in certain theming it could be shown left and right to the content region (eg. horizontal scrolling layouts), so it would rather be "before" and "after", but moving stuff from region to region just to work around something you cannot move is IMHO worse then just making what you cannot move movable :)
This is how it looks on the blocks admin:
Ps. I already have issues to make the help text a block and plan to follow along the line given enough progress in how this gets implemented. :)
Comment #40
gábor hojtsyObviously, renaming region "Content" or block "Main page content" to whatever else is completely possible, it does not change the concept.
Comment #41
David_Rothstein commentedThat's very, very neat...
Isn't the block module optional now in D7, though? I'm not sure if there were good reasons for making it optional or they just made it optional because they could, but either way, this patch doesn't work well if you turn the block module off :)
Comment #42
Noyz commentedNice. I get that you're more interested in concept/code, but couldn't help myself. IMHO, "body" would be the better name for this region. Teh word content is too overloaded in Drupal, and I think "body" or "page body" is what comes to mind when you think of the main element of a page.
Comment #43
ultimateboy commentedWonderful idea Gábor. It solves the naming problem, adds more functionality, and gives greater flexibility all around .. all with less code.. beautiful.
The only thing I fear is now the explanation of a block becomes difficult. I really like the idea of making all of these "magic theme variables" blocks so that they are seen and positional from the UI.. but then the true definition of a block becomes tricky. But we can worry about wording of help text later.
I did a quick testing of the patch, and things appear to work as suggested. I am in favor of this approach and in general removing as many of these variables from the theme. I can imagine every page.tpl variable ($messages, $help, $primary_nav, $search_box ... ...) being a block, positionable into any region, which makes page.tpl simple a structure of regions.. that would be beautiful. Anything that is in the direction of that goal, I am all for. And this is a wonderful start. +1 from me.
Comment #44
sunHm. While I like the idea, this has some drawbacks:
1) The block can be disabled too easily. Once disabled, your site renders _nothing_. At the very least, there should be safety measures to prevent this.
2) New/additional themes take the default block configuration from the default theme. As with 1), it will be hard to ensure proper output of this block in a Drupal site with multiple themes enabled.
3) Block module is indeed not required anymore. Primarily, to allow for alternative implementations (think Panels). I wouldn't like to see the dependency on Block module re-added. So, ideally, this works with and without Block module being enabled.
4) We need to explain themers and site admins when to use page.tpl.php overrides (like in the past) and when to adjust block visibility settings.
Regarding 1), that won't be easy, as themes (like Zen?) can use completely different region names and no "content" region at all. The most trivial approach would be to ensure that this block is enabled and assigned to a region in a form validation handler.
Comment #45
catchI think a fallback which just makes sure the content block is always assigned to a region is pretty good. Don't see a particular reason why we couldn't require all themes to have a 'main' or 'content' region for this block to live by default - in place of the $content variable.
This would also allow for caching to be enabled for the main content region using the existing block cache.
I think we should move this patch and discussion to a new issue - it'd be a major change and as sun points out has a lot of both good and potentially tricky implications.
Comment #46
skilip commentedAs much as I like the idea of having all current template variables available in the block system,I think we're making things much more complicated than needed. Just asigning the page's content to a new template variable, say $page_body, also fixes all stuff discussed here. The current system of theming is flexible enough IMO.
Comment #47
ultimateboy commentedskilip, simply renaming the variable does not solve the issue at hand. The issue that is trying to be solved is the fact that you cannot place blocks above $content. The content region sits below the page content output. The two ideas to solve this issue are, at the moment, split the content region into "content top" and "content bottom" where $content sits in-between the output of those two regions.. or, convert $content into a block, which therefore allows you to position it and change its weight, which in turn solves the problem (but opens up quite a few more issues as described in #41 and #44.
I'd say, lets keep this issue focused on splitting the content region in two, open a new issue based on Gábor's patch in #39, and postpone this issue until a decision has been made on that.
Comment #48
skilip commentedWell I didn't mean to just rename the $content variable. The problem here lies in that the page content is placed into the $content region, bypassing the normal block / region system. Therfore the $content region is an exeption in the regular region system. So what we want to do is separate the region from the page content. Gábors proposal fixes that issue big time, but raises a whole scala of new issues, wich can easily be avoided.
So if we'd change $content in a regular region (or split them up into content- top and -bottom) and put all page content in a new variable like $page_body, just like $messages and $tabs, we're done. Everybody happy :).
I defenately don't want to push this issue into bikeshed talk! I just don't see why we should rebuild a widely appreciated system.
Comment #49
xanoTo fix the problem of disappearing content we could add a #required parameter to blocks. Or we could just hardcode that $content should be in a region.
Comment #50
gábor hojtsyI think #45 explains the answers to #44 pretty well. The issue it does not address is block module dependency. The last time I've seen, panels supported putting blocks into its areas and also, if you disable block module I assume something else would come in in its place (otherwise you loose your search box, login box, etc. as well). Panels or that something else can just do system_set_content_block() to get the content data and display it however they like. I don't think we need to hardcode this to Drupal to do it always, if block module is not enabled, that would require panels to page alter that out.
Ps. I am fine with moving this off to a new issue and mark this as postponed.
Comment #51
skilip commented@Gábor: ho do you think about my comments at #46 and #48?
Comment #52
gábor hojtsy@skilip: this issue was all around doing the same thing you explain in #48 until I entered and derailed it saying that adding in "top" and "bottom" regions just show that we don't take advantage of the ordering feature in our regions system, while we should. So your suggestion was already debated in detail up until #37. We are talking about an alternate approach now.
Comment #53
skilip commentedAh, I totally missed that. Thanks for the clarification, sorry for not reading thoroughly. Is there another issue opened for this?
Comment #54
gábor hojtsyCopied over the patch and my introduction as well as concerns you had and solutions to those to #428744: Make the main page content a real block. Marking this postponed on that as suggested by ultimateboy. All, let's move to http://drupal.org/node/428744 and work together there!
Comment #55
gábor hojtsyComment #56
johnalbinSounds good to me. :-)
Comment #57
johnalbinNow that #428744: Make the main page content a real block has landed, a single content region finally makes sense. Wish it did in d6. ;-)