1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-07 21:56:33 +02:00

feat(shortcodes): [strings] shortcode - add capitalize modifier

This commit is contained in:
Awilum
2022-05-04 22:11:28 +03:00
parent ed8ca273ad
commit 1447a92d83
2 changed files with 7 additions and 0 deletions

View File

@@ -100,6 +100,10 @@ parsers()->shortcodes()->addHandler('strings', static function (ShortcodeInterfa
if ($key == 'camel') {
$content = strings($content)->{'camel'}()->toString();
}
if ($key == 'capitalize') {
$content = strings($content)->{'capitalize'}()->toString();
}
}
return (string) $content;

View File

@@ -52,4 +52,7 @@ test('[strings] shortcode', function () {
// camel
$this->assertEquals("fooBar", parsers()->shortcodes()->parse('[strings camel]foo_bar[/strings]'));
// capitalize
$this->assertEquals("That Country Was At The Same Stage Of Development As The United States In The 1940S", parsers()->shortcodes()->parse('[strings capitalize]that country was at the same stage of development as the United States in the 1940s[/strings]'));
});