You are here

public function WatchdogAggregatorSensorPlugin::verboseResultUnaggregated in Monitoring 8

Adds unaggregated verbose output to the render array $output.

Parameters

array &$output: Render array where the result will be added.

Overrides DatabaseAggregatorSensorPlugin::verboseResultUnaggregated

2 calls to WatchdogAggregatorSensorPlugin::verboseResultUnaggregated()
ImageMissingStyleSensorPlugin::verboseResultUnaggregated in src/Plugin/monitoring/SensorPlugin/ImageMissingStyleSensorPlugin.php
Adds unaggregated verbose output to the render array $output.
PhpNoticesSensorPlugin::verboseResultUnaggregated in src/Plugin/monitoring/SensorPlugin/PhpNoticesSensorPlugin.php
Adds unaggregated verbose output to the render array $output.
2 methods override WatchdogAggregatorSensorPlugin::verboseResultUnaggregated()
ImageMissingStyleSensorPlugin::verboseResultUnaggregated in src/Plugin/monitoring/SensorPlugin/ImageMissingStyleSensorPlugin.php
Adds unaggregated verbose output to the render array $output.
PhpNoticesSensorPlugin::verboseResultUnaggregated in src/Plugin/monitoring/SensorPlugin/PhpNoticesSensorPlugin.php
Adds unaggregated verbose output to the render array $output.

File

src/Plugin/monitoring/SensorPlugin/WatchdogAggregatorSensorPlugin.php, line 40
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\WatchdogAggregatorSensorPlugin.

Class

WatchdogAggregatorSensorPlugin
Watchdog aggregator which handles replacement of variables in the message.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function verboseResultUnaggregated(array &$output) {
  parent::verboseResultUnaggregated($output);

  // If sensor has message and variables, remove variables header.
  if (isset($output['verbose_sensor_result']['#rows']) && array_key_exists('message', $output['verbose_sensor_result']['#header']) && array_key_exists('variables', $output['verbose_sensor_result']['#header'])) {
    unset($output['verbose_sensor_result']['#header']['variables']);

    // Replace the message for every row.
    foreach ($output['verbose_sensor_result']['#rows'] as $delta => $row) {

      // Link the watchdog id to the dblog.
      $output['verbose_sensor_result']['#rows'][$delta]['wid'] = Link::fromTextAndUrl($row['wid'], Url::fromUserInput('/admin/reports/dblog/event/' . $row['wid']))
        ->toString();

      // Replace variables in message.
      $output['verbose_sensor_result']['#rows'][$delta]['message'] = new FormattableMarkup($row['message'], unserialize($row['variables']));

      // Do not render the raw message & variables in the row.
      unset($output['verbose_sensor_result']['#rows'][$delta]['variables']);
    }
  }
}