Skip to content

Instantly share code, notes, and snippets.

@victorpavlov
Last active December 22, 2015 08:49
Show Gist options
  • Save victorpavlov/6447658 to your computer and use it in GitHub Desktop.
Save victorpavlov/6447658 to your computer and use it in GitHub Desktop.
Drupal 7 Adding classes and id for block by preprocess_block From http://drupal.stackexchange.com/questions/30378/how-to-add-id-to-a-block
<?php
function MODULE_preprocess_block(&$variables) {
if ($variables['block']->module == 'contact' && $variables['block']->delta == 'contact_block') {
$variables['block_html_id'] = drupal_html_id('your-id-here');
$variables['classes_array'][] = drupal_html_class('your-class-here');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment