function rules_page_top
Implements hook_page_top().
File
-
./
rules.module, line 34
Code
function rules_page_top(array &$page_top) {
$debug_log = \Drupal::service('logger.rules_debug_log');
$markup = $debug_log->render();
// If debugging is turned off $markup will be empty.
if (!empty($markup)) {
if (\Drupal::currentUser()->hasPermission('access rules debug')) {
// Send debug output to the screen.
\Drupal::service('messenger')->addError($markup);
}
// Log debugging information to logger.channel.rules only if the rules
// system logging setting 'debug_log.system_debug' is enabled.
// These logs get sent to the system dblog, end up in the Drupal database,
// and are viewable at /admin/reports/dblog.
if (\Drupal::config('rules.settings')->get('debug_log.system_debug')) {
\Drupal::service('logger.channel.rules')->log(LogLevel::DEBUG, $markup, []);
}
}
// Remove logs already rendered.
$debug_log->clearLogs();
}