function IconDefinition::humanize

Humanize a text for admin display.

Parameters

string $text: The text to humanize.

Return value

string The human friendly text.

2 calls to IconDefinition::humanize()
IconDefinition::getLabel in core/lib/Drupal/Core/Theme/Icon/IconDefinition.php
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.