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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

foripepe’s picture

foripepe’s picture

Status: Active » Needs review
Jacine’s picture

Status: Needs review » Needs work

I 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:

skinr[some_skin][features][] = views_view
skinr[some_skin][features][] = block

We should be able to do:

skinr[some_skin][features][] = views_view_list
skinr[some_skin][features][] = block_menu

Both of the above are actual theme hooks, i.e. corresponding template files and make more sense.

Jacine’s picture

Title: Filter classes for different view styles. » Allow feature hooks to be more specific
moonray’s picture

Status: Needs work » Fixed

Because 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.

Jacine’s picture

Hey, so I just tried this out and noticed we are missing the view styles here (which are the most important, IMO):

  • views_view_list
  • views_view_grid
  • views_view_table
  • views_view_unformatted
  • views_view_jump_menu

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]

Jacine’s picture

Status: Fixed » Needs work

Also, for the sake of being consistent, it should be done for nodes too:

node_[node_type]

Jacine’s picture

Ok, and as I write documentation the rest comes to me... LOL. Here's the full (final) list all in one place:

Blocks

skinr[skin_system_name][features][] = block
skinr[skin_system_name][features][] = block_[module]

Comment

skinr[skin_system_name][features][] = comment_wrapper
skinr[skin_system_name][features][] = comment_wrapper_[node_type]

Nodes

skinr[skin_system_name][features][] = node
skinr[skin_system_name][features][] = node_[node_type]

Page (Body Classes)

skinr[skin_system_name][features][] = page

Panels

skinr[skin_system_name][features][] = panels_pane
skinr[skin_system_name][features][] = panels_panel

Views

skinr[skin_system_name][features][] = views_view
skinr[skin_system_name][features][] = views_view__[style_name]
skinr[skin_system_name][features][] = views_view__[display_name]
skinr[skin_system_name][features][] = views_view__[view_name]
skinr[skin_system_name][features][] = views_view__[view_name]__[display_name]
moonray’s picture

You 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.

moonray’s picture

Status: Needs work » Fixed

Just 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.