You are here

protected static function DomainConfigUIController::formatValue in Domain Access 8

Formats a value as a string, for readable output.

Taken from config_inspector module.

Parameters

mixed $value: The value element.

Return value

string The value in string form.

1 call to DomainConfigUIController::formatValue()
DomainConfigUIController::printArray in domain_config_ui/src/Controller/DomainConfigUIController.php
Prints array data for the form.

File

domain_config_ui/src/Controller/DomainConfigUIController.php, line 268

Class

DomainConfigUIController
Controller routines for AJAX callbacks for domain actions.

Namespace

Drupal\domain_config_ui\Controller

Code

protected static function formatValue($value) {
  if (is_bool($value)) {
    return $value ? 'true' : 'false';
  }
  if (is_scalar($value)) {
    return Html::escape($value);
  }
  if (empty($value)) {
    return '<' . t('empty') . '>';
  }
  return '<' . gettype($value) . '>';
}