You are here

function block_class_attributes in Block Class 6.2

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

Extract the custom CSS class data for the given block.

Parameters

object $block: The block object containing the keys 'module', 'delta', and 'theme'.

Return value

array An Array map containing custom class information for the block. The key '_' will map to any arbitrary class values that have been entered for the block. Additionally, there will be a key for each of the theme's block class group if a class from that group has been specified.

2 calls to block_class_attributes()
block_class in ./block_class.module
Get the HTML-ready classes for the given block.
block_class_form_block_admin_configure_alter in ./block_class.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function block_class_attributes($block, $reset = FALSE) {
  static $blocks;

  // If we've not fetched the data, or we're being reset, fetch all the data:
  if (is_null($blocks) || $reset) {
    $result = db_query("SELECT module, delta, css_class FROM {block_class}");
    while ($row = db_fetch_object($result)) {
      $blocks[$row->module][$row->delta] = unserialize($row->css_class);
    }
  }

  // Do we have info for this block:
  if (isset($blocks[$block->module][$block->delta])) {
    return $blocks[$block->module][$block->delta];
  }
  else {
    return array(
      '_' => '',
    );
  }
}