Skip to content

Commit

Permalink
Readable Labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanboring committed Oct 21, 2024
1 parent c0465e6 commit 612ed72
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public function renderFullReport(EntityInterface $entity): array {
if (strpos($key, '_') === 0 || $key === 'index') {
continue;
}
// Transform snake_case to human readable.
$label = ucwords(str_replace('_', ' ', $key));
// Transform every capital letter to a space and the letter.
$label = ucwords(strtolower(preg_replace('/(?<!^)[A-Z]/', ' $0', $key)));
$return['#rows'][] = [
$label,
$value,
Expand Down

0 comments on commit 612ed72

Please sign in to comment.