[drupal-devel] [feature] Enable multiple block regions (not just "left" and "right" sidebars)
Issue status update for http://drupal.org/node/16216 Project: Drupal Version: cvs Component: block.module Category: feature requests Priority: normal Assigned to: Anonymous Reported by: paragkenia Updated by: syscrusher Status: patch The first paragraph of adrian [1]'s post is a point that occurred to me also, as I read this thread. One suggestion would be to separate the definition and configuration of blocks, on one hand, from the placement of those blocks, on the other hand. In other words, Drupal core provides a mechanism defining what blocks exist, which of these are on by default or off by default and user-selectable vs. which are forced on for all users, and the configuration (if applicable) of specialized blocks defined by particular modules. Each theme provides a standard hook function that returns an array of region names and help/description text, e.g., array('left'=>t('This vertical region is left of the main content area'), 'right'=>t('This vertical region is right of the main content area'), 'footer'=>t('The footer is below the left, right, and main content areas of the page')). The theme part of Drupal core (i.e., theme.module itself, not the individual themes) provides a standard UI that is displayed within config of *each theme* (but is one physical code base within theme.module) that allows the administrator to map blocks defined by Drupal core into regions defined by the theme, and storing that mapping as an theme-to-block_ID-to-region_ID (with weight) table in the database. From there, the actual page rendering is similar to what's being done now, but there is more of it. I guess what I'm trying to say is that the key to solving this problem is breaking it along its degrees of orthogonality, and there are three -- two in Drupal core and one in the individual theme. Scott [1] http://drupal.org//user/1517 syscrusher Previous comments: ------------------------------------------------------------------------ January 26, 2005 - 05:27 : paragkenia I read the comparision discussion between *Drupal* and *Mambo*. In several messages it was outlined that Drupal can place blocks only in right and left and not flexible to put them on anywhere where one want. It will be great if this can be changed in upcoming versions. I am no pro at PHP, so don't know how much time this task will take, but I think it is very important. parag ------------------------------------------------------------------------ April 14, 2005 - 20:44 : nedjo This issue was apparently partially addressed in issue http://drupal.org/node/19694 [2]. [2] http://drupal.org/node/19694 ------------------------------------------------------------------------ April 16, 2005 - 19:24 : nedjo Attachment: http://drupal.org/files/issues/block-dynamic-regions.patch (8.17 KB) This much-requested functionality - to have the ability to place blocks in more than the two predefined regions - was partially addressed in issue http://drupal.org/node/19694. [3]. But "blocks" are still limited to the "left" and "right" sidebars (hard-coded in block.module). This patch is a first step designed to enable multiple (eventually, admin-definable) regions for blocks. I've moved the existing "left" and "right" block regions to a 'region' table (with ids of 0 and 1, as currently used in themes). Then all references to the regions are drawn dynamically from the table. This way, if further records are added, they will appear in the list of available regions for block placement. Doing this actually reduces some duplicated code, since it's no longer necessary to repeat code blocks for each of "left" and "right". As it stands, the patch doesn't add any new functionality--but I don't think it breaks anything either. New functionality would need (a) new regions defined, and (b) changes to themes. A simple first step might be, e.g., to add a "footer" region and then add a call in the footer generation to append any blocks assigned to the footer region there. I'm setting this to patch, but I'm aware that it needs some discussion and refining before it'll be ready to apply. [3] http://drupal.org/node/19694. ------------------------------------------------------------------------ April 16, 2005 - 20:05 : nedjo Attachment: http://drupal.org/files/issues/block_regions.png (5.65 KB) Here's a screenshot showing the block admin page, with drop-downs for region placement (the options are dynamically generated based on defined regions). ------------------------------------------------------------------------ April 16, 2005 - 21:57 : adrian The biggest problem with this is that you can have multiple themes, and each of these themes can have different regions available. Also, the method of defining which regions are available needs to be standardised. Some of the work that me and Vlado are working on for the install system would go towards solving that problem (ie: meta information for modules, themes and styles). This has been discussed to death, but the general consensus has been that we _want_ to do this, but we need to solve a few other problems properly first, the most pertinent being the interface issue. Chris (factoryjoe) recently did a whole mess of workflows for something related to this.
participants (1)
-
syscrusher