View block top class

Component ID

1985578

Component name

View block top class

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

2353

Component created

Component changed

Component body

Motivation

Views offers a "CSS Class" setting that can get classes in the markup that wraps your view content, but themers often need these classes in the top level of the markup (the block container), not nested inside.

What it does

This module does some nifty logic that adds CSS classes configured in your view to the block container (with "-container" appended) to help with styling and re-usability for view blocks, potentially across many different views and displays.

Usage instructions

Just turn it on! The settings you have configured for your view's "CSS Class" will now be in the block container's classes. There is no configuration and no UI.

--

Why should I?

Check out WebbyKat's article under the section "Why You Want to Add Classes to Your Blocks"

What about the Block Class module?

Block Class is cool too. One of the main advantages of this module is that your block settings apply on a per-view (or view display) basis rather than on a per-block basis. Also, module relies on the settings already configured in views, so there is no additional database storage or configuration aside from what you already have in your view.

What if I don't want a whole module for this?

View block top class just implements a preprocess function, so you are welcome to implement a copy into your own theme.

Sponsored and developed by TrestleMedia