You are here

protected function ConfigInspectorController::formatData in Configuration Inspector 8

Helper function to dump data in a reasonably reviewable fashion.

Parameters

string $data: The displayed data.

string $title: (Optional) The title. Defaults to "Data'.

Return value

array The render array.

1 call to ConfigInspectorController::formatData()
ConfigInspectorController::getRawData in src/Controller/ConfigInspectorController.php
Raw configuration data inspection.

File

src/Controller/ConfigInspectorController.php, line 424

Class

ConfigInspectorController
Defines a controller for the config_inspector module.

Namespace

Drupal\config_inspector\Controller

Code

protected function formatData($data, $title = 'Data') {
  if ($this->dumper && $this->moduleHandler
    ->moduleExists('devel')) {
    $output = $this->dumper
      ->export($data, $title);
  }
  else {
    $output = '<h2>' . $title . '</h2>';
    $output .= '<pre>';
    $output .= htmlspecialchars(var_export($data, TRUE));
    $output .= '</pre>';
    $output .= '<br />';
  }
  return [
    '#markup' => $output,
  ];
}