I am running into some situations where it would be nice for me to have a "CSS Class" option under the "Block Settings" section just like we have under the "Other" section. However, this class would be applied to the block div that contains the block id.

Before

<div id="block-views-webad-conferences-block-1" class="block block-views contextual-links-region">

After

<div id="block-views-webad-conferences-block-1" class="block block-views contextual-links-region my-new-class">

In the After code you will notice the last class "my-new-class" this will be the class that would get added from the "Block Settings" section of the block display.

Hope this is clearly stated. Thanks in advance!

Comments

merlinofchaos’s picture

While this would be handy, it's kind of tough to actually do, since that's block.tpl.php and not actually controlled by Views.

dawehner’s picture

In fact views could implement hook_preprocess_block and add the classes

merlinofchaos’s picture

The difficulty there is that the view is destroyed by the time the block template runs. It would have to fetch the data some other way.

Steven Brown’s picture

Unfortunately I don't know the flow of events that occur in Drupal enough to make a suggestion. Would it be more effort than what it's worth to you Merlin? Its not like we can't live w/o it :) Just a nicety to have.

merlinofchaos’s picture

To me? Probably yes. To someone else willing to write the patch? Hey if it can be written nicely I'd be willing to commit it.

dawehner’s picture

I'm wondering whether this setting should be an extra item in the ui, or be part of the existing css classes item?