diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index ce7f98eddb3..313fb09976a 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -54,6 +54,7 @@ - The `duration` Twig filter now has a `language` argument. ([#16332](https://github.com/craftcms/cms/pull/16332)) - The `indexOf` Twig filter now has a `default` argument, which can be any integer or `null`. (`-1` by default for backwards compatibility.) - It’s now possible to reference custom field handles in element queries’ `where` params. ([#16318](https://github.com/craftcms/cms/pull/16318)) +- Deprecated the `ucfirst` Twig filter. `capitalize` should be used instead. ### Extensibility - Added `craft\base\Element::EVENT_DEFINE_ALT_ACTIONS`. ([#16294](https://github.com/craftcms/cms/pull/16294)) diff --git a/src/templates/settings/plugins/index.twig b/src/templates/settings/plugins/index.twig index f1cc1219e4c..7d75657fc64 100644 --- a/src/templates/settings/plugins/index.twig +++ b/src/templates/settings/plugins/index.twig @@ -188,7 +188,7 @@ {% switch issue %} {% case 'wrong_edition' %} {{ 'This license is for the {name} edition.'|t('app', { - name: config.licensedEdition|ucfirst + name: config.licensedEdition|capitalize, }) }} {% case 'no_trials' %} {{ 'Plugin trials are not allowed on this domain.'|t('app') }} diff --git a/src/web/twig/Extension.php b/src/web/twig/Extension.php index 95194aa0fd6..97d3373fee8 100644 --- a/src/web/twig/Extension.php +++ b/src/web/twig/Extension.php @@ -462,9 +462,11 @@ public function truncateFilter(string $string, int $length, string $suffix = ' * * @param mixed $string The multibyte string. * @return string The string with the first character converted to upercase. + * @deprecated in 5.6.0 */ public function ucfirstFilter(mixed $string): string { + Craft::$app->getDeprecator()->log('ucfirst', 'The `|ucfirst` filter has been deprecated. Use `|capitalize` instead.'); return StringHelper::upperCaseFirst((string)$string); } @@ -474,6 +476,7 @@ public function ucfirstFilter(mixed $string): string * @param TwigEnvironment $env * @param string $string * @return string + * @deprecated in 3.5.0 */ public function ucwordsFilter(TwigEnvironment $env, string $string): string {