You are here

function hosting_js_page in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 hosting.module \hosting_js_page()
  2. 7.3 hosting.module \hosting_js_page()

Page callback for a page to be rendered in modal frame.

1 string reference to 'hosting_js_page'
hosting_menu in ./hosting.module
Implements hook_menu().

File

./hosting.module, line 171
Hosting module.

Code

function hosting_js_page() {
  modalframe_child_js();
  $args = func_get_args();
  $path = implode('/', $args);

  // In case Aegir is running in a sub-directory, the base_path should be
  // stripped away here. Remove the leading slash from base_path as $path
  // doesn't have one either.
  $path = str_replace(ltrim(base_path(), '/'), '', $path);
  menu_set_active_item($path);
  if ($router_item = menu_get_item($path)) {
    if ($router_item['access']) {
      if ($router_item['file']) {
        require_once $router_item['file'];
      }
      $return = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
    }
    else {
      $return = drupal_access_denied();
    }
  }

  // Menu status constants are integers; page content is a string.
  if (is_int($return) && module_exists('overlay')) {
    overlay_close_dialog();
  }
  return $return;
}