You are here

function asset_widget_get_rendered_tab_content in Asset 7

Render markup for widget tab.

1 call to asset_widget_get_rendered_tab_content()
asset_widget_get_tab_by_id in modules/asset_widget/asset_widget.admin.inc
Menu callback to get tab content by ID, or all enabled tabs if ID omitted.

File

modules/asset_widget/asset_widget.admin.inc, line 93
Assets widget administration pages logic.

Code

function asset_widget_get_rendered_tab_content($tab_info, $args, $use_cookie_fallback = FALSE) {
  $render_results = array();
  if (function_exists($tab_info['content_callback'])) {
    if (!empty($tab_info['arguments'])) {
      $actual_args = array();
      foreach ($tab_info['arguments'] as $arg) {
        if (isset($args[$arg])) {
          $actual_args[] = $args[$arg];
        }
        elseif ($use_cookie_fallback && !empty($_COOKIE['Drupal_asset_widget_' . $arg])) {
          $actual_args[] = $_COOKIE['Drupal_asset_widget_' . $arg];
        }
        elseif (isset($tab_info['defaults'])) {
          $actual_args[] = $tab_info['defaults'][$arg];
        }
      }
      $render_results = call_user_func_array($tab_info['content_callback'], $actual_args);
    }
    else {
      $render_results = call_user_func($tab_info['content_callback']);
    }
  }
  return render($render_results);
}