You are here

function _popup_block in Popup 7

Same name and namespace in other branches
  1. 8 includes/popup.api.inc \_popup_block()
  2. 7.x includes/popup.api.inc \_popup_block()
  3. 6.x includes/popup.api.inc \_popup_block()

File

includes/popup.api.inc, line 332

Code

function _popup_block($attributes, $return = FALSE) {
  $module = isset($attributes['module']) ? $attributes['module'] : 'block';
  $delta = isset($attributes['delta']) ? $attributes['delta'] : $attributes['block'];
  $block = module_invoke($module, 'block_info');
  $title = $attributes['title'] ? $attributes['title'] : $block[$delta]['info'];
  $block = module_invoke($module, 'block_view', $delta);
  $body = '<div class="block">' . (is_array($block['content']) ? drupal_render($block['content']) : $block['content']) . '</div>';
  if ($return == 'title') {
    return $title;
  }
  if ($return == 'body') {
    return $body;
  }
  return popup_element($title, $body, $attributes);
}