You are here

function _popup_block in Popup 8

Same name and namespace in other branches
  1. 7 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 333

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::service('renderer')
    ->render($block['content']) : $block['content']) . '</div>';
  if ($return == 'title') {
    return $title;
  }
  if ($return == 'body') {
    return $body;
  }
  return popup_element($title, $body, $attributes);
}