You are here

function fb_fbml_menu_local_tasks in Drupal for Facebook 6.2

File

themes/fb_fbml/template.php, line 146
Logic needed for FBML theme.

Code

function fb_fbml_menu_local_tasks() {
  global $fb;

  // menu.inc generates the local task (tab) markup in a convoluted and inflexible way.  Because of this we generate markup with <fb:tab-item ...> for the secondary links.  Here we use replacement to "fix" this.
  if ($fb && $fb
    ->in_fb_canvas()) {
    $output = '';
    if ($primary = menu_primary_local_tasks()) {
      $output .= "<fb:tabs>\n" . $primary . "</fb:tabs>\n";
    }
    if ($secondary = menu_secondary_local_tasks()) {

      // replace fb:tab-items with list items
      $pattern = '|<fb:tab-item href="([^"]*)" title="([^"]*)"([^>]*)>([^<]*)</fb:tab-item>|';
      $replace = '<li $3><a href="$1">$4</a></li>';
      $secondary = preg_replace($pattern, $replace, $secondary);
      $output .= "<ul class=\"tabs secondary\">\n" . $secondary . "</ul>\n";
    }
  }
  else {
    $output = theme_menu_local_tasks();
  }
  return $output;
}