function _homebox_get_css_classes_for_block in Homebox 6
Same name and namespace in other branches
- 6.3 homebox.module \_homebox_get_css_classes_for_block()
- 6.2 homebox.module \_homebox_get_css_classes_for_block()
- 7.3 homebox.module \_homebox_get_css_classes_for_block()
- 7.2 homebox.module \_homebox_get_css_classes_for_block()
Helper function which adds CSS classes to block, for jQuery to work properly
Parameters
$block:
Return value
string containing CSS classes
1 call to _homebox_get_css_classes_for_block()
- homebox_load_blocks_in_regions in ./
homebox.module - Loads available blocks for user
File
- ./
homebox.module, line 751 - Home box main file, takes care of global functions settings constants, etc.
Code
function _homebox_get_css_classes_for_block($block, $pid) {
$classes = array(
'homebox-portlet',
);
// Is the block movable?
$movable = (bool) db_result(db_query("SELECT movable FROM {homebox_default} WHERE bid = %d", $block['bid']));
$classes[] = $movable ? 'homebox-draggable' : NULL;
// Adds CSS class for collapsed block
if (!is_null($block['open'])) {
$classes[] = (bool) $block['open'] ? FALSE : ' homebox-portlet-collapsed';
}
// Adds CSS for closed block
if (!is_null($block['status'])) {
$classes[] = (bool) $block['status'] ? NULL : 'homebox-portlet-closed';
}
// Adds color css class
if (variable_get('homebox_users_use_colors_' . $pid, FALSE)) {
if ($block['color'] != '' && drupal_strlen($block['color']) == 7 && strpos($block['color'], '#') == 0) {
$classes[] = 'homebox-color-' . drupal_strtolower(ltrim($block['color'], "#"));
}
}
return implode(" ", $classes);
}