Skip to content

Instantly share code, notes, and snippets.

@Soraph
Soraph / template.php
Last active August 29, 2015 13:59
Add a custom CSS class to an image in Drupal 7
<?php
function fancythemename_preprocess_image(&$variables) {
if (isset($variables['style_name'])) {
if ($variables['style_name'] == 'fancystylename')
$variables['attributes']['class'][] = 'img-thumbnail'; //bootstrap class
}
}
@Soraph
Soraph / magicelements.css
Created March 24, 2014 11:53
Highlight each element on the page
/*
Source: http://b.qr.ae/1rmTvEY
*/
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }