I would like to add intelligent grid calculator functionality to Blueprint base theme.
There are two steps.
1. Add intelligent grid calculator to base theme. See the layout-1.patch
To understand this see bellow:
blueprint_grid_calculate_items_classes(array('left' => 6, 'center' => 'auto', 'right' => 6), $vars);
This function calculates center 'region' classes instead of old code. (It included several if/case)
Why is this code better?
- If you wan to change e.g. the width of left, you must modify one place only. (four places in the old code)
- If you want to add a new sidebar e.g. left-second (new layout is "left | left-second | center | right") you must add a new element to the array in the arguments. Certainly you must modify the .info file and page.tpl.php.
- if you have special layout which has collection of sidebars, you can calculate its widths easily
(I am seeing right now that my code doesn't calculate col-x class, but if you think it's a good idea I correct the patch. It works with the base theme.)
2. Add a bar phrase.
The "sidebar" includes blocks vertically. The bar includes blocks horizontally and calculates widths of the blocks automatically. See the layout-2.patch.
I added a new top_bar region. If you add blocks to this region you can see how the code works. If you add 1 block, the block width is 24, if you add 2 blocks the blocks' widths are 12, if you add 3 blocks, the blocks' widths are 8 and etc.
3. Reorder sidebars.
You can reorder sidebars easily. See layout-3.patch
$widht_and_pos = blueprint_grid_calculate_items_classes(array('left' => 6, 'center' => 'auto', 'right' => 6), $vars);
blueprint_grid_reorder_items_classes(array('center', 'right', 'left'), $widht_and_pos, $vars);
This idea is the least sophisticated one, but the patch works for me.
I must hack, the css because the blueprint's pull and push isn't good for reorder. See the patch:
http://blueprintcss.lighthouseapp.com/projects/15318/tickets/114-pushpul...
The layout-3.patch includes all the changes, and layout-2.patch includes the layout-1.patch.
What do you think about this idea?
Comment | File | Size | Author |
---|---|---|---|
blueprint-layout-3.patch | 14.06 KB | pp | |
blueprint-layout-2.patch | 11.22 KB | pp | |
blueprint-layout-1.patch | 6.18 KB | pp |