public static function DomainConfigUIController::printArray in Domain Access 8
Prints array data for the form.
Parameters
array $array: An array of data. Note that we support two levels of nesting.
Return value
string A suitable output string.
2 calls to DomainConfigUIController::printArray()
- DeleteForm::buildForm in domain_config_ui/
src/ Form/ DeleteForm.php - Build configuration form with metadata and values.
- DomainConfigUIController::inspectConfig in domain_config_ui/
src/ Controller/ DomainConfigUIController.php - Controller for inspecting configuration.
File
- domain_config_ui/
src/ Controller/ DomainConfigUIController.php, line 225
Class
- DomainConfigUIController
- Controller routines for AJAX callbacks for domain actions.
Namespace
Drupal\domain_config_ui\ControllerCode
public static function printArray(array $array) {
$items = [];
foreach ($array as $key => $val) {
if (!is_array($val)) {
$value = self::formatValue($val);
$item = [
'#theme' => 'item_list',
'#items' => [
$value,
],
'#title' => self::formatValue($key),
];
$items[] = render($item);
}
else {
$list = [];
foreach ($val as $k => $v) {
$list[] = t('<strong>@key</strong> : @value', [
'@key' => $k,
'@value' => self::formatValue($v),
]);
}
$variables = [
'#theme' => 'item_list',
'#items' => $list,
'#title' => self::formatValue($key),
];
$items[] = render($variables);
}
}
$rendered = [
'#theme' => 'item_list',
'#items' => $items,
];
return render($rendered);
}