You are here

public function ImageMissingStyleSensorPlugin::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 WatchdogAggregatorSensorPlugin::verboseResultUnaggregated

File

src/Plugin/monitoring/SensorPlugin/ImageMissingStyleSensorPlugin.php, line 143
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\ImageMissingStyleSensorPlugin.

Class

ImageMissingStyleSensorPlugin
Monitors image derivate creation errors from dblog.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function verboseResultUnaggregated(array &$output) {
  parent::verboseResultUnaggregated($output);
  foreach ($output['verbose_sensor_result']['#rows'] as $key => $row) {

    /** @var \Drupal\Component\Render\FormattableMarkup $message */
    $message = $row['message'];
    $tmp_str = substr($message
      ->jsonSerialize(), strpos($message
      ->jsonSerialize(), '>') + 1);
    $output['verbose_sensor_result']['#rows'][$key]['path'] = substr($tmp_str, 0, strpos($tmp_str, '<'));
    unset($output['verbose_sensor_result']['#rows'][$key]['message']);
    unset($output['verbose_sensor_result']['#rows'][$key]['timestamp']);
    $output['verbose_sensor_result']['#rows'][$key]['timestamp'] = $row['timestamp'];
  }
  $output['verbose_sensor_result']['#header']['path'] = 'image path';
  unset($output['verbose_sensor_result']['#header']['message']);
  unset($output['verbose_sensor_result']['#header']['timestamp']);
  $output['verbose_sensor_result']['#header']['timestamp'] = 'timestamp';
}