You are here

function block_class in Block Class 6.2

Same name and namespace in other branches
  1. 5 block_class.module \block_class()
  2. 6 block_class.module \block_class()
  3. 7 block_class.module \block_class()

Get the HTML-ready classes for the given block.

@TODO Verify correct behavior in theme. All classes from the arbitrary text field should be present and only the selected classes from the theme checkboxes.

Parameters

object $block: The block object.

Return value

string A string containing all the classes for the block.

1 call to block_class()
block_class_preprocess_block in ./block_class.module
Implementation of template_preprocess_block().
3 string references to 'block_class'
block_class_install in ./block_class.install
Implements hook_install().
block_class_uninstall in ./block_class.install
Implements hook_uninstall().
block_class_update_6100 in ./block_class.install
Implements hook_update_N().

File

./block_class.module, line 47
Provides core logic for adding block classes.

Code

function block_class($block) {
  global $theme;
  if (!isset($block->theme)) {
    $block->theme = $theme;
  }
  $attributes = block_class_attributes($block);
  $classes = array_key_exists('_', $attributes) ? $attributes['_'] : '';
  if (array_key_exists($theme, $attributes)) {
    $classes .= ' ' . implode(' ', $attributes[$theme]);
  }
  return check_plain($classes);
}