You are here

function panels_mini_block_view in Panels 7.3

Implementation of hook_block_view().

See also

panels_mini_panels_mini_content_type_render()

File

panels_mini/panels_mini.module, line 94
panels_mini.module

Code

function panels_mini_block_view($delta = 0) {

  // Static recursion protection.
  static $viewing = array();
  if (!empty($viewing[$delta])) {
    return;
  }
  $viewing[$delta] = TRUE;
  $panel_mini = panels_mini_load($delta);
  if (empty($panel_mini)) {

    // Bail out early if the specified mini panel doesn't exist.
    return;
  }
  ctools_include('context');
  $contexts = array();
  if (module_exists('page_manager') && ($current_page = page_manager_get_current_page())) {
    if (!empty($current_page['contexts'])) {
      $contexts = ctools_context_match_required_contexts($panel_mini->requiredcontexts, $current_page['contexts']);
    }
  }
  drupal_alter('panels_mini_block_contexts', $contexts, $panel_mini);
  $panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini, FALSE, $contexts);
  $panel_mini->display->css_id = panels_mini_get_id($panel_mini->name);
  $panel_mini->display->owner = $panel_mini;
  $block = array();
  $block['content'] = panels_render_display($panel_mini->display);
  $block['subject'] = $panel_mini->display
    ->get_title();
  unset($viewing[$delta]);
  return $block;
}