function IconDefinition::humanize

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Theme/Icon/IconDefinition.php \Drupal\Core\Theme\Icon\IconDefinition::humanize()

Humanize a text for admin display.

Parameters

string $text: The text to humanize.

Return value

string The human friendly text.

1 call to IconDefinition::humanize()
IconDefinitionTest::testCreateIcon in core/tests/Drupal/Tests/Core/Theme/Icon/IconDefinitionTest.php
Test the IconDefinition::createIcon method.

File

core/lib/Drupal/Core/Theme/Icon/IconDefinition.php, line 206

Class

IconDefinition
Handle an icon definition.

Namespace

Drupal\Core\Theme\Icon

Code

public static function humanize(string $text) : string {
  return (string) u($text)->snake()
    ->replace('_', ' ')
    ->title(allWords: TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.