Skip to content

Commit

Permalink
5.6: Deprecate ucfirst filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustMiller committed Jan 24, 2025
1 parent 4f68785 commit 6fe0590
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions docs/5.x/reference/twig/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ Filter | Description
[translate](#translate-or-t) | Translates a message.
[trim](https://twig.symfony.com/doc/3.x/filters/trim.html) | Strips whitespace from the beginning and end of a string.
[truncate](#truncate) | Truncates a string to a given length, while ensuring that it does not split words.
[ucfirst](#ucfirst) | Capitalizes the first character of a string.
[unique](#unique) | Removes duplicate values from an array.
[unshift](#unshift) | Prepends one or more items to the beginning of an array.
[upper](https://twig.symfony.com/doc/3.x/filters/upper.html) | Formats a string into “UPPER CASE”.
Expand Down Expand Up @@ -1492,13 +1491,26 @@ If you’d prefer to have the entire word removed, set the `splitSingleWord` arg

## `ucfirst`

::: warning
The `ucfirst` filter is deprecated. Use Twig’s native [`capitalize`](https://twig.symfony.com/doc/3.x/filters/capitalize.html) filter, instead.
:::

Capitalizes the first character of a string.

```twig
{{ 'foobar'|ucfirst }}
{# Output: Foobar #}
```

## `ucwords`

Uppercases the first character of each word in a string.

```twig
{{ 'foo bar baz hyphenated-pair'|ucwords }}
{# Output: Foo Bar Baz Hyphenated-Pair #}
```

## `unique`

Runs an array through [array_unique()](http://php.net/manual/en/function.array-unique.php).
Expand All @@ -1519,15 +1531,6 @@ Prepends one or more items to the beginning of an array, and returns the new arr
{# Result: ['bar', 'baz', 'foo'] #}
```

## `ucwords`

Uppercases the first character of each word in a string.

```twig
{{ 'foo bar baz hyphenated-pair'|ucwords }}
{# Output: Foo Bar Baz Hyphenated-Pair #}
```

## `values`

Returns an array of all the values in a given array, but without any custom keys.
Expand Down

0 comments on commit 6fe0590

Please sign in to comment.