function drupal_set_page_content

Sets the main page content value for later use.

Given the nature of the Drupal page handling, this will be called once with a string or array. We store that and return it later as the block is being displayed.

Parameters

$content: A string or renderable array representing the body of the page.

Return value

If called without $content, a renderable array representing the body of the page.

6 calls to drupal_set_page_content()
drupal_render_page in drupal/core/includes/common.inc
Renders the page, including all theming.
ExceptionController::on403Html in drupal/core/lib/Drupal/Core/Controller/ExceptionController.php
Processes an AccessDenied exception into an HTTP 403 response.
ExceptionController::on404Html in drupal/core/lib/Drupal/Core/Controller/ExceptionController.php
Processes a NotFound exception into an HTTP 404 response.
SystemMainBlock::build in drupal/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMainBlock.php
Builds and returns the renderable array for this block plugin.
system_batch_page in drupal/core/modules/system/system.admin.inc
Default page callback for batches.

... See full list

File

drupal/core/includes/common.inc, line 4299
Common functions that many Drupal modules will need to reference.

Code

function drupal_set_page_content($content = NULL) {
  $content_block =& drupal_static(__FUNCTION__, NULL);
  $main_content_display =& drupal_static('system_main_content_added', FALSE);

  // Filter out each empty value, though allow '0' and 0, which would be
  // filtered out by empty().
  if ($content !== NULL && $content !== '') {
    $content_block = is_array($content) ? $content : array(
      'main' => array(
        '#markup' => $content,
      ),
    );
  }
  else {

    // Indicate that the main content has been requested. We assume that
    // the module requesting the content will be adding it to the page.
    // A module can indicate that it does not handle the content by setting
    // the static variable back to FALSE after calling this function.
    $main_content_display = TRUE;
    return $content_block;
  }
}