Closed (fixed)
Project:
Skinr
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
15 Oct 2010 at 20:13 UTC
Updated:
17 Dec 2010 at 20:00 UTC
Jump to comment: Most recent file
The type select list is totally broken. Some observations:
regions[sidebar_first] = Sidebar first and theme (b) has regions[sidebar_first] = First sidebar, this list will show the one that loads last.
I think the solution here is to create a select with an optgroup:
<select id="edit-rule-type" name="rule_type" class="form-select required">
<option value="page">Page</option>
<optgroup label="Bartik regions">
<option value="region__header">Header</option>
<option value="region__help">Help</option>
<option value="region__highlighted">Highlighted</option>
<option value="region__content">Content</option>
<option value="region__sidebar_first">Sidebar first</option>
<option value="region__sidebar_second">Sidebar second</option>
<option value="region__triptych_first">Triptych first</option>
<option value="region__triptych_middle">Triptych middle</option>
<option value="region__triptych_last">Triptych last</option>
<option value="region__footer_firstcolumn">Footer first column</option>
<option value="region__footer_secondcolumn">Footer second column</option>
<option value="region__footer_thirdcolumn">Footer third column</option>
<option value="region__footer_fourthcolumn">Footer fourth column</option>
</optgroup>
<optgroup label="Seven regions">
<option value="region__content">Content</option>
<option value="region__help">Help</option>
</optgroup>
<optgroup label="Stark regions">
<option value="region__content">Content</option>
<option value="region__footer">Content</option>
<option value="region__header">Header</option>
<option value="region__help">Help</option>
<option value="region__highlighted">Highlighted</option>
<option value="region__sidebar_first">Sidebar first</option>
<option value="region__sidebar_second">Sidebar second</option>
</optgroup>
<optgroup label="Garland regions">
<option value="region__content">Content</option>
<option value="region__footer">Content</option>
<option value="region__header">Header</option>
<option value="region__help">Help</option>
<option value="region__highlighted">Highlighted</option>
<option value="region__sidebar_first">Sidebar first</option>
<option value="region__sidebar_second">Sidebar second</option>
</optgroup>
</select>
Basically, a list of regions that are not hidden grouped by themes, and ordered alphabetically.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 942950-17.patch | 3.05 KB | jacine |
| #15 | Regions-before.png | 24.61 KB | vrajak@gmail.com |
| #15 | Regions-Patched.png | 95.29 KB | vrajak@gmail.com |
| #11 | skinr_942950_11.patch | 2.83 KB | moonray |
| #7 | 942950-7.patch | 1.87 KB | jacine |
Comments
Comment #1
jacine@moonray said he was working on this, on Friday, so assigning it to him in the meantime so no one else works on it.
Comment #2
moonray commentedHere's that patch.
Comment #3
jacineI'm still getting disabled themes in this list and I don't see the point of showing their regions here. To modify any theme settings the theme needs to be enabled, so we should follow the same logic. I'd like to remove the "Region: " and keep it in the option group label, because it's too redundant.
I'm going to give it a shot.
Comment #4
jacineThere's no need for a fieldset here, so I'm removing that. Also noting that there is an issue with the hook_menu() types. I am not getting proper titles where I should, so trying to figure out why.
Comment #5
moonray commentedNew patch.
Fieldset removed, and disabled themes no longer show in the list.
Comment #6
nomonstersinme commentedThis is looking good to me!
Edit: re-tested with drupal head and it looks the same as the photo
Comment #7
jacineAs I mentioned in the original issue, I'd like to remove the redundant "Regions:" text from the label:
Here's an updated patch (with comments), and a screenshot of what it looks like.
Comment #8
nomonstersinme commentedThis looks just like your png on my set up :)
Comment #9
moonray commentedLooks good to me. RTBC+
Comment #10
sunIt would be a good idea to keep the additional top-level 'rule' parent key, even though the fieldset is removed. That potentially allows other modules to extend the form.
Speaking of, it would be a good idea to set
$form['#tree'] = TRUE;
and adjust the form's validation and submit handlers to act on $form_state['values']['rule'] instead.
1) $regions would be a better variable name.
2) Ideally put the comment above the initialization of $regions = array().
3) That comment reads a bit odd. Also, it talks about multiple themes, but the code only processes regions of one theme.
Regions are actually keyed by $name and their value is a $title.
Both the old and the new code use t() incorrectly.
t() should contain the entire string, using placeholders for replacement variables, so as to allow translators to understand that "Regions" is actually part of a larger string (which potentially can appear in front of the theme name in some languages).
Thus:
$key = t('@name regions', array('@name' => $theme->info['name']));
Note: I didn't look up whether @name is the correct placeholder token type. It's possible that we need to use !name, if http://api.drupal.org/api/function/form_select_options/7 already calls check_plain() for the optgroup.
However, looking at it as I'm typing, it seems like it's taking over the key as-is, so @name should be correct.
Powered by Dreditor.
Comment #11
moonray commentedHere's a patch that addresses all those issues.
Comment #13
nomonstersinme commentedThis looks good to me visually.. code wise i dunno ;)
Comment #14
jacine#11: skinr_942950_11.patch queued for re-testing.
Comment #15
vrajak@gmail.com commentedPatch works just fine for me, and certainly cleans up the Rule selection list. I don't know why the patch failed testing, it applied without any errors on my setup. I can't comment on any coding, but as nomonstersinme said it looks good visually.
Attaching "before" and "after" patch photos just for reference.
Comment #16
jacineHm, this no longer applies. I'll reroll.
Comment #17
jacineCommitted: http://drupal.org/cvs?commit=458992