function block_class_attributes in Block Class 6
Same name and namespace in other branches
- 5 block_class.module \block_class_attributes()
- 6.2 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_alter in ./
block_class.module - Implements hook_form_FORM_ID_alter().
File
- ./
block_class.module, line 57 - 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 css_class, module, delta FROM {block_class}");
while ($row = db_fetch_object($result)) {
$blocks[$row->module][$row->delta] = $row;
}
}
// Do we have info for this block:
if (isset($blocks[$block->module][$block->delta])) {
return $blocks[$block->module][$block->delta];
}
else {
$undef = (object) NULL;
$undef->css_class = '';
return $undef;
}
}