You are here

function angularjs_deliver_page_content in AngularJS 7

Delivers only the main content of the requested page, for pjax requests.

1 string reference to 'angularjs_deliver_page_content'
angularjs_page_delivery_callback_alter in ./angularjs.module
Implements hook_page_delivery_callback_alter().

File

./angularjs.module, line 19

Code

function angularjs_deliver_page_content($page_callback_result) {
  if (is_int($page_callback_result)) {

    // Pass over to drupal_deliver_html_page() to deal with errors.
    drupal_deliver_html_page($page_callback_result);
  }
  else {
    if (is_null(drupal_get_http_header('Content-Type'))) {
      drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
    }

    // $page_callback_result contains the main contents of the page.
    // Add a page title, which will be picked up and used by pjax.
    $output = '<title>' . drupal_get_title() . '</title>' . render($page_callback_result);
    $output .= drupal_get_js();
    print $output;

    // Make sure the requests are cached. pajax requests will be cached separately
    // from standard page requests thanks to the "_pjax" query string.
    drupal_page_footer();
  }
}