A feature of Skinr that we use a lot, is the ability to give classes to views.
However, because the output of the view is very dependant upon the chosen style (list, grid, unformatted), it would be really nice to specify for each Skinr class, for which view-types they are available.
Like this:
skinr[view-options][title] = Layout options
skinr[view-options][type] = select
skinr[view-options][description] = Choose a layout option
skinr[view-options][features][] = views_view
; skinr[view-options][views_restrictions][] = style-grid
skinr[view-options][views_restrictions][] = style-list
; skinr[view-options][views_restrictions][] = style-table
; skinr[view-options][views_restrictions][] = style-unformatted
skinr[view-options][options][1][label] = first item left
skinr[view-options][options][1][class] = view-first-item-left
skinr[view-options][options][2][label] = first item right
skinr[view-options][options][2][class] = view-first-item-right
We've created patches (6.1, 6.2, 7.1, HEAD) that allows this.
Comment | File | Size | Author |
---|---|---|---|
#1 | skinr-DRUPAL-6--1.patch | 2.11 KB | foripepe |
#1 | skinr-DRUPAL-6--2.patch | 2.34 KB | foripepe |
#1 | skinr-DRUPAL-7--1.patch | 2.1 KB | foripepe |
#1 | skinr-HEAD.patch | 2.1 KB | foripepe |
Comments
Comment #1
foripepe CreditAttribution: foripepe commentedComment #2
foripepe CreditAttribution: foripepe commentedComment #3
JacineI think is this is definitely useful, but I wouldn't want to restrict the functionality to views and would want it implemented differently.
skinr[x][features][]
is where I think this belongs. This is really just the theme hook (we should probably change the name of this to just "hook" because it's kind of confusing). Anyway, here's where I'm going with this...Let's say you only want to use a style on menu blocks and views lists.
Instead of:
We should be able to do:
Both of the above are actual theme hooks, i.e. corresponding template files and make more sense.
Comment #4
JacineComment #5
moonray CreditAttribution: moonray commentedBecause of some limitations in knowing the hooks before page render happens (i.e. when you're editing skinr settings), I've implemented a reduced subset of more specific hooks.
blocks module: block_[module], block
comment module: comment_wrapper_[node_type], comment_wrapper
views module: views_view__[view_name]__[display_name], views_view__[display_name], views_view__default, views_view__[view_name], views_view
If we need any more, we're going to have to add code for them. Let me know.
Committed to CVS.
Comment #6
JacineHey, so I just tried this out and noticed we are missing the view styles here (which are the most important, IMO):
It should also be able to pick up styles provided by other modules, like jQuery UI carousel, Views Rotator, etc. if possible.
So... views_view_[style]
Comment #7
JacineAlso, for the sake of being consistent, it should be done for nodes too:
node_[node_type]
Comment #8
JacineOk, and as I write documentation the rest comes to me... LOL. Here's the full (final) list all in one place:
Blocks
Comment
Nodes
Page (Body Classes)
Panels
Views
Comment #9
moonray CreditAttribution: moonray commentedYou missed the following:
skinr[skin_system_name][features][] = panels_display
skinr[skin_system_name][features][] = views_view__default
I'm not sure why views isn't returning the style based names (we're using views' function to return those derived hooks). I'll try and figure it out.
Comment #10
moonray CreditAttribution: moonray commentedJust looked at this further, and found the following: Our skinr styles are currently being applied to the views_view hook. views_view_[style] refers to the row style, which is a different hook all together, so we would never get the derived hooks that include style.
In order to get that working, we're going to have to add more layers of skin-able parts for views (like panels has panels_display, panels_panel, panels_pane). But that would be a whole separate issue. Opened a new issue #732592: Add support for views row style.
Committed node_[node_type] hook code to CVS.