You are here

function responsive_navigation_block_view in Responsive Navigation 7

Implements hook_block_view().

File

./responsive_navigation.module, line 196

Code

function responsive_navigation_block_view($delta = 1) {
  list($menu_name, $mlid) = explode(':', variable_get('responsive_navigation_menu_' . $delta, 'navigation:0'));
  $depth = variable_get('responsive_navigation_depth_' . $delta, '-1');
  if ($output = theme('responsive_navigation', array(
    'id' => $delta,
    'menu_name' => $menu_name,
    'mlid' => $mlid,
    'depth' => $depth,
  ))) {
    $block['content']['#markup'] = $output['content'];

    // If we're building the navigation block
    // use the same block title logic as menu module.
    global $user;
    if ($output['subject'] == t('navigation') && $user->uid) {
      $subject = $user->name;
    }
    else {
      $subject = $output['subject'];
    }
    $block['subject'] = check_plain($subject);
    $block['content']['#contextual_links']['simple_menus'] = array(
      'admin/structure/menu/manage',
      array(
        $menu_name,
      ),
    );
  }
  else {
    $block['content'] = FALSE;
  }
  return $block;
}