function rules_page_build

Implements hook_page_build() to add the rules debug log to the page bottom.

File

./rules.module, line 1397

Code

function rules_page_build(&$page) {
    // Invoke a the page redirect, in case the action has been executed.
    // @see rules_action_drupal_goto()
    if (isset($GLOBALS['_rules_action_drupal_goto_do'])) {
        list($url, $force) = $GLOBALS['_rules_action_drupal_goto_do'];
        drupal_goto($url);
    }
    if (isset($_SESSION['rules_debug'])) {
        $region = rules_debug_log_region();
        foreach ($_SESSION['rules_debug'] as $log) {
            $page[$region]['rules_debug'][] = array(
                '#markup' => $log,
            );
            $page[$region]['rules_debug']['#theme_wrappers'] = array(
                'rules_log',
            );
        }
        unset($_SESSION['rules_debug']);
    }
    if (rules_show_debug_output()) {
        $region = rules_debug_log_region();
        $page[$region]['rules_debug']['#pre_render'] = array(
            'rules_debug_log_pre_render',
        );
    }
}