---
title: "stdWrap"
manual: "TypoScript Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3tsref:stdwrap@main"
source: "Functions/Stdwrap.rst"
modified: "2026-09-15T19:22:01+00:00"
---

# stdWrap

A "stdWrap" TypoScript property ("standard wrap") is a function that "wraps"
text values. A TEXT object value is parsed by the stdWrap function using the value's properties
as parameters.

**Table of contents**

-   [Content-supplying properties of stdWrap](https://docs.typo3.org/permalink/t3tsref:content-supplying-properties-of-stdwrap@main)
-   [Properties](https://docs.typo3.org/permalink/t3tsref:properties@main)
-   [Example](https://docs.typo3.org/permalink/t3tsref:example@main)

## Content-supplying properties of stdWrap

The properties that can be supplied as parameters are listed below.

> [!NOTE]
> Content-supplying properties are those that import content
> from other variables or arrays. These properties are parsed in the order `data`,
> `field`, `current`, `cObject`.

For further information see
[EXT:frontend/Classes/ContentObject/ContentObjectRenderer.php (GitHub)](https://github.com/typo3/typo3/blob/main/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php)
on the `stdWrap()` function and on the array `STD_WRAP_ORDER`,
which represents the order of execution.

Use the `stdWrap` property "orderedStdWrap" if you want to execute
multiple `stdWrap` functions in an order you choose.

In the example below, the line `10.value = some text` is discarded
because the value is imported from the header field in
`$cObj->data-array`.

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
10 = TEXT
10.value = some text
10.stdWrap.case = upper
10.stdWrap.field = header
```

## Properties

### Properties for getting data

**setContentToCurrent**

-   **setContentToCurrent**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Sets the current value to the incoming content of the function.

**addPageCacheTags**

-   **addPageCacheTags**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Comma-separated list of cache tags to tag pages in the page
    cache.

    **Examples**

    ```typoscript
    addPageCacheTags = pagetag1,pagetag2,pagetag3
    ```

    This will add the tags "pagetag1", "pagetag2" and "pagetag3" to the
    cached pages in cache_pages.

    Cached pages with a tag can be deleted from the cache using the TSconfig option
    [TCEMAIN.clearCacheCmd](https://docs.typo3.org/permalink/t3tsref:pagetcemain-clearcachecmd@main).

    > [!NOTE]
    > To store rendered content in the
    > caching framework use the [](https://docs.typo3.org/permalink/t3tsref:stdwrap-cache@main)`cache`
    > property.

**setCurrent**

-   **setCurrent**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Sets the "current"-value. This is normally set from an external
    routine, so be careful with this. But it might come in useful.

**lang**

-   **lang**

    -   *Type:* Array of language keys / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    This is used to define optional language specific values based on the
    [current site language](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SiteHandling/AddLanguages.html#sitehandling-addingLanguages).

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = TEXT
    page.10.value = I am a Berliner!
    page.10.stdWrap.lang.de = Ich bin ein Berliner!
    ```

    Output will be "Ich bin..." instead of "I am..."

**data**

-   **data**

    -   *Type:* [Data / getText](https://docs.typo3.org/permalink/t3tsref:data-type-gettext@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

**field**

-   **field**

    -   *Type:* Field name / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Sets the content to the value of the corresponding field
    (from `$cObj->data[*field*]`).

    > [!NOTE]
    > `$cObj->data` changes depending on the context.
    > See the description of the data type "[Data / getText](https://docs.typo3.org/permalink/t3tsref:data-type-gettext@main)" field

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10.field = title
    ```

    This sets the content to the value of the field "title".

    You can provide multiple field name options separated by "//".

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10.field = nav_title // title
    ```

    The content from the `nav_title` field will be returned
    unless it is a blank string. If it is a blank string, the value of
    the title field is returned.

**current**

-   **current**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Sets the content to the "current" value (see [->split](https://docs.typo3.org/permalink/t3tsref:split@main))

**cObject**

-   **cObject**

    -   *Type:* [Content Objects (cObject)](https://docs.typo3.org/permalink/t3tsref:data-type-cobject@main)

    Loads content from a content object.

**numRows**

-   **numRows**

    -   *Type:* [->numRows](https://docs.typo3.org/permalink/t3tsref:numrows@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Returns the number of rows resulting from a supplied `SELECT` query.

**preUserFunc**

-   **preUserFunc**

    -   *Type:* [function name](https://docs.typo3.org/permalink/t3tsref:data-type-function-name@main)

    > [!IMPORTANT]
    > > [!NOTE]
    > > **Changed in version 14.0**
    > >
    > > PHP functions called via TypoScript **must** now use the PHP
    > > attribute `#[AsAllowedCallable]`
    > > (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

    Calls a provided PHP function. If you specify the name with a '->'
    in it, then it is interpreted as a call to a class method.

    Two parameters are sent to the PHP function: a
    content variable, which contains the current content (the
    value to be processed), and any sub-properties of
    preUserFunc.

    PHP functions called via TypoScript **must** use the PHP
    attribute `#[AsAllowedCallable]`
    (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

    See [](https://docs.typo3.org/permalink/t3tsref:stdwrap-postuserfunc@main)`postUserFunc`.

### Properties for overriding and conditions

**override**

-   **override**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    If `override` returns something other than "" or zero (trimmed), the
    content is loaded with this.

**preIfEmptyListNum**

-   **preIfEmptyListNum**

    -   *Type:* (as "[](https://docs.typo3.org/permalink/t3tsref:stdwrap-listnum@main)" below)

**ifNull**

-   **ifNull**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Sets the content if the content is null (`NULL` type in PHP).

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = COA_INT
    page.10 {
       10 = TEXT
       10 {
          stdWrap.field = description
          stdWrap.ifNull = No description defined.
       }
    }
    ```

    This example displays the content of the description field or, if that
    value is `NULL`, the text "No description defined.".

**ifEmpty**

-   **ifEmpty**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    If the trimmed content is empty, the content is loaded
    with `ifEmpty`. Zeros are treated as empty values.

**ifBlank**

-   **ifBlank**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Same as `ifEmpty` but the check is done against '' (empty
    string). Zeros are not treated as blank values.

**listNum**

-   **listNum**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Explodes the current content [](https://docs.typo3.org/permalink/t3tsref:stdwrap-listnum-splitchar@main)
    (Default: `,`) and returns the object specified by `listNum`.

    Possible values:

    -   **`last`**

        The special keyword `last` is replaced with the index of
        the last element in the exploded content.

    -   **`rand`**

        The special keyword `rand` is replaced with the index of
        a random element in the exploded content.

    -   **[Calculating values (+calc)](https://docs.typo3.org/permalink/t3tsref:calc@main)**

        After the special keywords are replaced with their numeric
        values.

    -   **0 - last**

        If the content of `listNum` can be interpreted as an integer the
        corresponding index of the exploded content is returned. Counting
        starts at 0.

    **Examples**

    This would return "item 1":

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = TEXT
    page.10.value = item 1, item 2, item 3, item 4
    page.10.listNum = 0
    ```

    This would return "item 3"

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = TEXT
    page.10.value = item 1, item 2, item 3, item 4
    page.10.listNum = last – 1
    ```

    **listNum.splitChar**

    -   **listNum.splitChar**

        -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main)
        -   *Default:* `,` (comma)

        **Examples**

        Splits the content of the `subtitle` field by the pipe character and returns
        a random element

        **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

        ```typoscript
        page.5 = COA_INT
        page.5 {
           10 = TEXT
           10 {
              stdWrap.field = subtitle
              stdWrap.listNum = rand
              stdWrap.listNum.splitChar = |
           }
        }
        ```

**trim**

-   **trim**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    If set, the PHP-function `trim()` removes whitespace around the value.

**strPad**

-   **strPad**

    -   *Type:* [strPad](https://docs.typo3.org/permalink/t3tsref:strpad@main)

    Pads the current content to a certain length. You can define the padding
    characters and which side(s) the padding should be added.

**stdWrap**

-   **stdWrap**

    -   *Type:* [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Recursive call to the `stdWrap` function.

**required**

-   **required**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    This flag requires the content to be set to a certain value after a
    content import and any processing that has occurred
    (data, field, current, listNum, trim). Zero is **not** regarded as
    empty. Use "if" instead.

    If the content is empty, "" is returned.

**if**

-   **if**

    -   *Type:* [if](https://docs.typo3.org/permalink/t3tsref:if@main)

    If the if-object returns false, stdWrap returns "".

**fieldRequired**

-   **fieldRequired**

    -   *Type:* Field name / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    The value in this field **must** be set.

### Properties for parsing data

**csConv**

-   **csConv**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Converts the charset of the string from the charset given as a value to
    the current rendering charset of the frontend (UTF-8).

**parseFunc**

-   **parseFunc**

    -   *Type:* object path reference / [parseFunc](https://docs.typo3.org/permalink/t3tsref:parsefunc@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Processing instructions to be applied to content.

    > [!NOTE]
    > If you enter a string value, this will be interpreted as a
    > reference to a global object path in the TypoScript object tree.
    > This will be the basic configuration for parseFunc merged with any
    > properties you add here. It works like references does for
    > content elements.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 {
        parseFunc = < lib.parseFunc_RTE
        parseFunc.tags.myTag = TEXT
        parseFunc.tags.myTag.value = This will be inserted when &lt;myTag&gt; is found!
    }
    ```

[](https://docs.typo3.org/permalink/t3tsref:stdwrap-htmlsanitize@main)`htmlSanitize` is enabled by default when
[](https://docs.typo3.org/permalink/t3tsref:stdwrap-parsefunc@main)`parseFunc` is invoked. This includes the Fluid Viewhelper
`<f:format.html>`, since it invokes [](https://docs.typo3.org/permalink/t3tsref:stdwrap-parsefunc@main)`parseFunc`
directly using `lib.parseFunc_RTE`.

The following example shows how to disable the sanitization behavior (enabled
by default). This is not recommended.

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
// either disable globally
lib.parseFunc.htmlSanitize = 0
lib.parseFunc_RTE.htmlSanitize = 0

// or disable individually per use case
10 = TEXT
10 {
    value = <div><img src="invalid.file" onerror="alert(1)"></div>
    parseFunc =< lib.parseFunc_RTE
    parseFunc.htmlSanitize = 0
}
```

Since an invocation of `stdWrap.parseFunc` triggers HTML
sanitization, the following example causes a lot of generated markup to be
sanitized and can be solved by explicitly disabling it with `htmlSanitize = 0`.

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
10 = FLUIDTEMPLATE
10 {
    templateRootPaths {
        // ...
    }
    variables {
        // ...
    }
    stdWrap.parseFunc {
        // replace --- with soft-hyphen
        short.--- = &shy;
        // sanitization of ALL MARKUP is NOT DESIRED here
        htmlSanitize = 0
    }
}
```

**HTMLparser**

-   **HTMLparser**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [HTMLparser](https://docs.typo3.org/permalink/t3tsref:htmlparser@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    This object allows you to parse HTML content and perform advanced
    filtering on the content.

    Value must be set and properties are those of [HTMLparser](https://docs.typo3.org/permalink/t3tsref:htmlparser@main).

    (See [Rich text editors (RTE)](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Rte/Index.html#rte) for more information about RTE transformations)

**split**

-   **split**

    -   *Type:* [split](https://docs.typo3.org/permalink/t3tsref:split@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

**replacement**

-   **replacement**

    -   *Type:* [replacement](https://docs.typo3.org/permalink/t3tsref:replacement@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Performs an ordered search/replace on the current content and
    PCRE regular expressions can be used. An array with numeric
    indices defines the order of actions and thus allows multiple
    replacements at once.

**prioriCalc**

-   **prioriCalc**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Calculation of the value using operators -+\*/%^ while respecting
    the priority of + and - operators and parenthesis levels ().

    . (period) is a decimal delimiter.

    Returns a double value.

    If `prioriCalc` is set to `intval`, an integer is returned.

    There is no error checking, and division by zero or other invalid
    values may generate strange results. You should use proper syntax
    because future modifications to the function may add more
    operators and features.

    **Examples**

    **Example Output for different calculations**

    ```none
    100%7 = 2
    -5*-4 = 20
    +6^2 = 36
    6 ^(1+1) = 36
    -5*-4+6^2-100%7 = 54
    -5 * (-4+6) ^ 2 - 100%7 = 98
    -5 * ((-4+6) ^ 2) - 100%7 = -22
    ```

**char**

-   **char**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Content is set to `chr(*value*)`. This returns a one-character
    string containing the character specified by ascii code. Reliable
    results will be obtained only for character codes in the integer
    range 0 - 127. See
    [the PHP manual](https://php.net/manual/en/function.chr.php):

    ```php
    $content = chr((int)$conf['char']);
    ```

**intval**

-   **intval**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    PHP function `intval()` returns an integer:

    ```php
    $content = intval($content);
    ```

**hash**

-   **hash**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Returns a hashed value of the current content. Set to one of the
    algorithms which are available in PHP. For a list of supported
    algorithms see [https://www.php.net/manual/en/function.hash-algos.php](https://www.php.net/manual/en/function.hash-algos.php).

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = TEXT
    page.10 {
       value = test@example.org
       stdWrap.hash = md5
       stdWrap.wrap = <img src="https://www.gravatar.com/avatar/|" />
    }
    ```

**round**

-   **round**

    -   *Type:* [round](https://docs.typo3.org/permalink/t3tsref:round@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Round the value using the selected method to the given number of
    decimals.

**numberFormat**

-   **numberFormat**

    -   *Type:* [numberFormat](https://docs.typo3.org/permalink/t3tsref:numberformat@main)

    Format a float value to the number format you need (e.g. useful for
    prices).

**date**

-   **date**

    -   *Type:* [date-conf](https://docs.typo3.org/permalink/t3tsref:data-type-date-conf@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    The content should be the an integer representing the UNIX time (second since 1.1.1970). Returns content
    formatted as a date. See the PHP manual ([datetime.format](https://www.php.net/manual/en/datetime.createfromformat.php))
    for format codes.

    ```php
    $content = date($conf['date'], $content);
    ```

    Properties:

    **.GMT:** If set, the PHP function [gmdate()](https://www.php.net/gmdate) will be
    used instead of [date()](https://www.php.net/date).

    **Examples**

    Render in human readable form:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 = TEXT
    page.10.value {
       # format like 2017-05-31 09:08
       field = tstamp
       date = Y-m-d H:i
    }
    ```

    > [!NOTE]
    > You should consider using the more flexible function
    > [](https://docs.typo3.org/permalink/t3tsref:stdwrap-formatteddate@main)`formattedDate`.

**strtotime**

-   **strtotime**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main)

    Allows conversion of formatted dates to timestamps, for example to perform date calculations.

    Possible values are `1` or any time string valid as the first
    argument of the PHP `strtotime()` function.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.date_as_timestamp = TEXT
    lib.date_as_timestamp {
       value = 2015-04-15
       strtotime = 1
    }
    ```

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.next_weekday = TEXT
    lib.next_weekday {
       data = GP:selected_date
       strtotime = + 2 weekdays
       strftime = %Y-%m-%d
    }
    ```

**strftime**

-   **strftime**

    -   *Type:* [](https://docs.typo3.org/permalink/t3tsref:data-type-strftime-conf@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Similar to property `date`, but uses a different format. See the PHP manual
    ([strftime](https://www.php.net/strftime)) for format codes.

    This formatting is useful if the locale is set in the
    [CONFIG](https://docs.typo3.org/permalink/t3tsref:config@main) object.

    Properties:

    -   **.charset**

        Can be set to the charset of the output string if you need to
        convert it to UTF-8. The default is to take the
        charset predicted by `\TYPO3\CMS\Core\Charset\CharsetConverter`.

    -   **.GMT**

        If set, PHP function [gmstrftime()](https://www.php.net/gmstrftime) will be used instead of
        [strftime()](https://www.php.net/strftime).

    > [!NOTE]
    > You should consider using the more flexible function
    > [](https://docs.typo3.org/permalink/t3tsref:stdwrap-formatteddate@main)`formattedDate`.

**formattedDate**

-   **formattedDate**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main)

    This function renders date and time based on formats/patterns defined by
    the International Components for Unicode standard (ICU). ICU-based date and
    time formatting is much more flexible for rendering than
    [](https://docs.typo3.org/permalink/t3tsref:stdwrap-date@main)`date` or [](https://docs.typo3.org/permalink/t3tsref:stdwrap-strftime@main)`strftime`, as it ships
    with default patterns for date and time based on the given locale
    (the examples below are for locale `en-US` and timezone `America/Los_Angeles`):

    -   `FULL`, for example: `Friday, March 17, 2023 at 3:00:00 AM Pacific Daylight Time`
    -   `LONG`, for example: `March 17, 2023 at 3:00:00 AM PDT`
    -   `MEDIUM`, for example: `Mar 17, 2023, 3:00:00 AM`
    -   `SHORT`, for example: `3/17/23, 3:00 AM`

    TYPO3 also adds custom patterns:

    -   `FULLDATE`, for example: `Friday, March 17, 2023`
    -   `FULLTIME`, for example: `3:00:00 AM Pacific Daylight Time`
    -   `LONGDATE`, for example: `March 17, 2023`
    -   `LONGTIME`, for example: `3:00:00 AM PDT`
    -   `MEDIUMDATE`, for example: `Mar 17, 2023`
    -   `MEDIUMTIME`, for example: `3:00:00 AM`
    -   `SHORTDATE`, for example: `3/17/23`
    -   `SHORTTIME`, for example: `3:00 AM`

    > [!NOTE]
    > You can specify your own pattern to suit your requirements, for example:
    > `qqqq, yyyy` will result in `1st quarter, 2023`. Have a look into the
    > [available options](https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax).

    The locale is typically fetched from the
    [locale setting](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SiteHandling/AddLanguages.html#sitehandling-addingLanguages-locale) in the
    site configuration.

    Properties:

    -   **.locale**

        A locale other than the locale of the site language.

    **Example: Full German output from a date/time value**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.my_formatted_date = TEXT
    lib.my_formatted_date {
        value = 2023-03-17 3:00:00
        formattedDate = FULL
        # Optional, if a different locale is wanted other than the site language's locale
        formattedDate.locale = de-DE
    }
    ```

    will result in "Freitag, 17. März 2023 um 03:00:00 Nordamerikanische Westküsten-Sommerzeit".

    **Example: Full French output from a relative date value**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.my_formatted_date = TEXT
    lib.my_formatted_date {
        value = -5 days
        formattedDate = FULL
        formattedDate.locale = fr-FR
    }
    ```

    will result in "dimanche 12 mars 2023 à 11:16:44 heure d’été du Pacifique".

    **Example: Custom format from a timestamp**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.my_formatted_date = TEXT
    lib.my_formatted_date {
        value = 1679022000
        formattedDate = Y-MM-dd'T'HH:mm:ssZ
    }
    ```

    will return the date in the ISO 8601 format: "2023-03-17T03:00:00+00:00"

    > [!NOTE]
    > The timezone will be taken from the setting `date.timezone` in your
    > `php.ini`.

**age**

-   **age**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) or [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    If enabled with a "1" (number, integer) the content is seen as a date
    (UNIX-time) and the difference between current time and the content-time
    is returned as one of these eight variations:

    "xx min" or "xx hrs" or "xx days" or "xx yrs" or "xx min" or "xx hour"
    or "xx day" or "year"

    The upper limits of the variations are 60 minutes, 24 hours and
    365 days.

    If you set this property as non-integer, it is used to format the
    eight units. The first four values are the plural values and the last
    four are singular. This is the default string:

    **Default string for age format**

    ```none
    min| hrs| days| yrs| min| hour| day| year
    ```

    Set another string if you want to change the units. You can include
    "-" signs. They will be removed, but they make sure that there is a
    space between the number and the unit.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    lib.ageFormat = TEXT
    lib.ageFormat.stdWrap.data = page:tstamp
    lib.ageFormat.stdWrap.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr"
    ```

**case**

-   **case**

    -   *Type:* string / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Converts case

    Uses "UTF-8" for the operation.

    **Possible values:**

    | Value | Effect |
    | --- | --- |
    | `upper` | Convert all letters of the string to uppercase |
    | `lower` | Convert all letters of the string to lowercase |
    | `capitalize` | Convert the first character of each word in the string to uppercase |
    | `ucfirst` | Convert the first letter of the string to uppercase |
    | `lcfirst` | Convert the first letter of the string to lowercase |
    | `uppercamelcase` | Convert underscored `upper_camel_case` to `UpperCamelCase` |
    | `lowercamelcase` | Convert underscored `lower_camel_case` to `lowerCamelCase` |

    **Example**

    Code:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10.value = Hello world!
    10.case = upper
    ```

    Result:

    **Example Output**

    ```text
    HELLO WORLD!
    ```

**bytes**

-   **bytes**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)
    -   *Default:* iec, 1024

    This is for number values. When the 'bytes' property is added and set
    to 'true' then a number will be formatted in 'bytes' style with two
    decimals, for example, '1.53 KiB' and '1.00 MiB'.
    Learn about common notations in
    [Wikipedia "Kibibyte"](https://en.wikipedia.org/wiki/Kibibyte).
    IEC naming with base 1024 is the default. Use subproperties for
    customisation.

    -   **.labels = iec**

        This is the default. IEC labels and base 1024 are used.
        Built in IEC labels are `" | Ki| Mi| Gi| Ti| Pi| Ei| Zi| Yi"`.
        You need to append a final string like 'B' or '-Bytes' yourself.

    -   **.labels = si**

        SI labels and base 1000 are used. Built in IEC labels are
        `" | k| M| G| T| P| E| Z| Y"`.
        You need to append a final string like 'B' yourself.

    -   **.labels = "..."**

        Custom values can be defined such as
        `.labels = " Byte| Kilobyte| Megabyte| Gigabyte"`. Use a
        vertical bar to separate the labels. Enclose the whole string in
        double quotes.

    -   **.base = 1000**

        You can set custom labels to base 1000. All
        other values, including the default, are base 1024.

    > [!NOTE]
    > **New in version 14.1**
    >
    > The TypoScript function `stdWrap.bytes` now accepts an
    > additional configuration parameter `decimals`.

    -   **.decimals**

        allows the number of decimals in the resulting number representation
        to be explicitly defined. By default, the  number of decimals is
        derived from the formatted size.

    > [!WARNING]
    > **Attention**
    >
    > If the value isn't a number the internal PHP function may issue a
    > warning which can interrupt execution depending on you error
    > handling settings. Example:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 {
       value = abc
       bytes = 1
    }

    will show `0` but may raise a warning or an exception.
    ```

    **Examples**

    Output value 1000 without special formatting. Shows `1000`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
    }
    ```

    Format value 1000 in IEC style with base=1024. Shows `0.98 Ki`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
    }
    ```

    Format value 1000 in IEC style with base=1024 and 'B' supplied by us.
    Shows `0.98 KiB`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       noTrimWrap = ||B|
    }
    ```

    Format value 1000 in SI style with base=1000. Shows `1.00 k`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       bytes.labels = si
    }
    ```

    Format value 1000 in SI style with base=1000 and 'b' supplied by us.
    Shows `1.00 kb`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       bytes.labels = si
       noTrimWrap = ||b|
    }
    ```

    Format value 1000 with custom label and base=1000. Shows
    `1.00 x 1000 Bytes`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       bytes.labels = " x 1 Byte| x 1000 Bytes"
       bytes.base = 1000
    }
    ```

    Format value 1000 with custom label and base=1000. Shows
    `1.00 kilobyte (kB)`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       bytes.labels = " byte (B)| kilobyte (kB)| megabyte (MB)| gigabyte (GB)| terabyte (TB)| petabyte (PB)| exabyte (EB)| zettabyte (ZB)| yottabyte YB"
       bytes.base = 1000
    }
    ```

    Format value 1000 with custom label and base=1024. Shows
    `0.98 kibibyte (KiB)`:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.10 = TEXT
    page.10 {
       value = 1000
       bytes = 1
       bytes.labels = " byte (B)| kibibyte (KiB)| mebibyte (MiB)| gibibyte (GiB)| tebibyte (TiB)| pepibyte (PiB)| exbibyte (EiB)| zebibyte (ZiB)| yobibyte YiB"
       bytes.base = 1024
    }
    ```

**substring**

-   **substring**

    -   *Type:* \[p1\], \[p2\] / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Returns the substring with \[p1\] and \[p2\] sent as the 2nd and 3rd
    parameter to the PHP [mb_substr](https://www.php.net/mb_substr) function.

    Uses "UTF-8".

**cropHTML**

-   **cropHTML**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Crops the content to a certain length. In contrast to `stdWrap.crop`, it
    respects HTML tags. It does not crop inside tags and closes open tags.
    Entities (like ">") are counted as one char. See `stdWrap.crop` below
    for a syntax description and examples.

    Note that `stdWrap.crop` should not be used if `stdWrap.cropHTML` is
    already being used.

**stripHtml**

-   **stripHtml**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Strips all HTML tags.

**crop**

-   **crop**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Crops the content to a certain length.

    You can define up to three parameters, where the third one is
    optional. The syntax is:
    \[number of characters to keep\] | \[ellipsis\] | \[keep whole words\]

    numbers of characters to keep (integer): Defines the number of characters
    to keep. For positive numbers, the first characters from the
    beginning of the string will be kept, for negative numbers, the last
    characters from the end will be kept.

    ellipsis (string): The symbols to be added replacing the part that was
    cropped. If the number of characters to keep is positive, the string will
    be *prepended* with the ellipsis, if it is negative, the string will
    be *appended* with the ellipsis.

    keep whole words (boolean): If set to 0 (default), the string is
    cropped after the defined number of characters. If set to 1,
    complete words are kept. A word which would normally be cut
    in the middle will be removed.

    **Examples**

    `20 | ...` => max 20 characters. If more, the value will be truncated
    to the first 20 characters and prepended with "..."

    `-20 | ...` => max 20 characters. If more, the value will be truncated
    to the last 20 characters and appended with "..."

    `20 | ... | 1` => max 20 characters. If more, the value will be
    truncated to the first 20 characters and prepended with "...". If
    the division is in the middle of a word, the rest of that word will be
    removed.

    Uses "UTF-8".

**rawUrlEncode**

-   **rawUrlEncode**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Passes the content through the [rawurlencode()](https://www.php.net/rawurlencode)
    PHP function .

**htmlSpecialChars**

-   **htmlSpecialChars**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Passes the content through the [htmlspecialchars()](https://www.php.net/htmlspecialchars) PHP function.

    Additional property `preserveEntities` will preserve entities so that only
    non-entity characters are affected.

**encodeForJavaScriptValue**

-   **encodeForJavaScriptValue**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Encodes content so that it can be safely used inside strings in JavaScript.
    Characters which can cause problems inside JavaScript strings are
    replaced with their encoded equivalents. The resulting string is
    quoted with single quotes.

    Passes the content through the core function
    `\TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue()`.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10.stdWrap {
          data = GP:sWord
          encodeForJavaScriptValue = 1
          wrap = setSearchWord(|);
    }
    ```

**doubleBrTag**

-   **doubleBrTag**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Double line breaks are substituted with this value.

**br**

-   **br**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Pass the value through the [nl2br()](https://www.php.net/nl2br) PHP function. This
    converts each line break to a `<br />` or a `<br>` tag depending on doctype.

**brTag**

-   **brTag**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    All ASCII codes of "10" (line feed, LF) are substituted with the
    *value* of this property.

**encapsLines**

-   **encapsLines**

    -   *Type:* [encapsLines](https://docs.typo3.org/permalink/t3tsref:encapslines@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Lets you split the content with `chr(10)` and process each line
    independently. Used to format RTE content .

**keywords**

-   **keywords**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Splits the content by characters "," ";" and `chr(10)` (return), trims
    each value and returns a comma-separated list of the values.

### Properties for wrapping data

**innerWrap**

-   **innerWrap**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Wraps content.

**innerWrap2**

-   **innerWrap2**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Same as `innerWrap` (but watch the order in which they are executed).

**preCObject**

-   **preCObject**

    -   *Type:* [Content Objects (cObject)](https://docs.typo3.org/permalink/t3tsref:data-type-cobject@main)

    [](https://docs.typo3.org/permalink/t3tsref:stdwrap-cobject@main)`cObject` prepended the content.

**postCObject**

-   **postCObject**

    -   *Type:* [Content Objects (cObject)](https://docs.typo3.org/permalink/t3tsref:data-type-cobject@main)

    [](https://docs.typo3.org/permalink/t3tsref:stdwrap-cobject@main)`cObject` appended the content.

**wrapAlign**

-   **wrapAlign**

    -   *Type:* string / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)
    -   *Allowed values:* `left`, `center`, `right`

    Wraps content with `<div style=text-align:[*value*];"> | </div>`
    *if* align is set.

**typolink**

-   **typolink**

    -   *Type:* [typolink](https://docs.typo3.org/permalink/t3tsref:typolink@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Wraps content with a link tag.

**wrap**

-   **wrap**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) /+.splitChar / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    `splitChar` defines an alternative splitting character (the default is "|"
    \- the vertical line)

**noTrimWrap**

-   **noTrimWrap**

    -   *Type:* "special" wrap /+.splitChar / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    This wraps the content *without* trimming the values. That means that
    surrounding whitespace is not removed. Note that this kind of wrap
    needs a special character in the middle as well as the same special
    character at the beginning and end of the wrap (the default
    for all three is "|").

    **Additional property:**

    `splitChar`

    Can be set to define an alternative special character. `stdWrap` is
    available. The default is "|" - the vertical line. This subproperty is
    useful when the default special character would be recognized
    by [optionSplit](https://docs.typo3.org/permalink/t3tsref:optionsplit@main) (which takes precedence over `noTrimWrap`).

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10.noTrimWrap = | val1 | val2 |
    ```

    In this example the values val1 and val2 will be wrapped, including the
    whitespace.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10 {
       noTrimWrap = ^ val1 ^ val2 ^ || ^ val3 ^ val4 ^
       noTrimWrap.splitChar = ^
    }
    ```

    [optionSplit](https://docs.typo3.org/permalink/t3tsref:optionsplit@main) will use the "||" to determine two subparts. In
    each subpart `noTrimWrap` will then use the "^" as
    special character.

**wrap2**

-   **wrap2**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) /+.splitChar / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    same as [](https://docs.typo3.org/permalink/t3tsref:stdwrap-wrap@main)`wrap` (but watch the order in which they are executed)

**dataWrap**

-   **dataWrap**

    -   *Type:* mixed / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    The content is parsed for pairs of curly braces. The content of the
    curly braces is of the type [Data / getText](https://docs.typo3.org/permalink/t3tsref:data-type-gettext@main) and is substituted with the result
    of [Data / getText](https://docs.typo3.org/permalink/t3tsref:data-type-gettext@main).

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page.10.dataWrap = <div id="{page : uid}"> | </div>
    ```

    This will produce a `<div>` tag around the content with an id attribute
    that contains the id of the current page.

**prepend**

-   **prepend**

    -   *Type:* [Content Objects (cObject)](https://docs.typo3.org/permalink/t3tsref:data-type-cobject@main)

    [](https://docs.typo3.org/permalink/t3tsref:stdwrap-cobject@main) prepended to content (before)

**append**

-   **append**

    -   *Type:* [Content Objects (cObject)](https://docs.typo3.org/permalink/t3tsref:data-type-cobject@main)

    [](https://docs.typo3.org/permalink/t3tsref:stdwrap-cobject@main) appended to content (after)

**wrap3**

-   **wrap3**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) /+.splitChar / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    same as `wrap` (but watch the order in which they are executed)

**orderedStdWrap**

-   **orderedStdWrap**

    -   *Type:* Array of numeric keys with / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main) each

    Execute multiple `stdWrap` statements in an order that
    you choose. The order is determined by the numeric order of the keys.You
    can use multiple stdWrap statements without having to remember the rather complex sorting
    order in which the `stdWrap` functions are executed.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10.value = a
    10.stdWrap.orderedStdWrap {
       30.wrap = |.

       10.wrap = is | working
       10.innerWrap = &nbsp;|&nbsp;

       20.wrap = This|solution
       20.stdWrap.wrap = &nbsp;|&nbsp;
    }
    ```

    In this example orderedStdWrap is executed on the value "a".
    `10.innerWrap` is executed first, followed by `10.wrap`.
    Then the 20 key is processed. Finally `30.wrap`
    is executed on what already was created.

    This results in "This is a working solution."

**outerWrap**

-   **outerWrap**

    -   *Type:* [wrap](https://docs.typo3.org/permalink/t3tsref:data-type-wrap@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Wraps the complete content

**insertData**

-   **insertData**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    If set, then the content string is parsed like `dataWrap` above.

    **Examples**

    Displays the page title:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10.value = This is the page title: {page:title}
    10.stdWrap.insertData = 1

    # TEXT is already stdWrapable, so we can also use insertData right away
    20 = TEXT
    20.value = <link rel="preload" href="{path : EXT:site/Resources/Public/Fonts/Roboto.woff2}" as="font" type="font/woff2" crossorigin="anonymous">
    20.insertData = 1
    ```

> [!WARNING]
> Never use this on content that can be edited in the backend. This would
> allows editors to disclose information that is normally hidden. Never
> use this to insert data into wraps. Use [](https://docs.typo3.org/permalink/t3tsref:stdwrap-datawrap@main)
> `dataWrap` instead.

**postUserFunc**

-   **postUserFunc**

    -   *Type:* [function name](https://docs.typo3.org/permalink/t3tsref:data-type-function-name@main)

    > [!NOTE]
    > **Changed in version 14.0**
    >
    > PHP functions called via TypoScript **must** now use the PHP
    > attribute `#[AsAllowedCallable]`
    > (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

    Calls the provided PHP function. If the function name contains '->',
    it will be interpreted as a call to a class method.

    Two parameters are sent to the PHP function: a
    content variable containing the current content (this is the value that
    will be processed) and subproperties of
    `postUserFunc`.

    See description of the [USER](https://docs.typo3.org/permalink/t3tsref:cobj-user@main) `cObject` for
    more in-depth information.

    PHP functions called via TypoScript **must** use the PHP
    attribute `#[AsAllowedCallable]`
    (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

    **Examples**

    You can paste this example directly into a new template record:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    page = PAGE
    page.typeNum = 0

    page.10 = TEXT
    page.10 {
        value = Hello World!
        stdWrap.postUserFunc = MyVendor\SitePackage\UserFunctions\YourClass->reverseString
        stdWrap.postUserFunc.uppercase = 1
    }

    page.20 = TEXT
    page.20 {
        value = Hello World!
        stdWrap.postUserFunc = MyVendor\SitePackage\UserFunctions\YourClass->reverseString
        stdWrap.postUserFunc.uppercase = 1
        stdWrap.postUserFunc.typolink = 11
    }

    ```

    Your methods will get the parameters `$content` and `$conf`
    (in that order) and need to return a string.

    **EXT:site_package/Classes/UserFunctions/YourClass.php**

    ```php
    <?php

    declare(strict_types=1);

    namespace MyVendor\SitePackage\UserFunctions;

    use Psr\Http\Message\ServerRequestInterface;
    use TYPO3\CMS\Core\Attribute\AsAllowedCallable;
    use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

    final class YourClass
    {
      /*
       * Reference to the parent (calling) cObject set from TypoScript
       */
      private ContentObjectRenderer $cObj;

      public function setContentObjectRenderer(
        ContentObjectRenderer $cObj,
      ): void {
        $this->cObj = $cObj;
      }

      /**
       * Custom method for data processing. Also demonstrates
       * how this gives us the ability to use methods in the
       * parent object.
       *
       * @param string $content holds the value to be processed.
       * @param array $conf TypoScript properties passed to this method.
       */
      #[AsAllowedCallable]
      public function reverseString(
        string $content,
        array $conf,
        ServerRequestInterface $request,
      ): string {
        $content = strrev($content);
        if (isset($conf['uppercase']) && $conf['uppercase'] === '1') {
          // Use the method caseshift() from ContentObjectRenderer
          $content = $this->cObj->caseshift($content, 'upper');
        }
        if (isset($conf['typolink'])) {
          // Use the method typoLink() from ContentObjectRenderer
          $content = $this->cObj
              ->typoLink($content, ['parameter' => $conf['typolink']]);
        }
        return $content;
      }
    }

    ```

    For `page.10`: the content which exists when
    `postUserFunc` is executed, will be processed by the function
    `reverseString()` in the class `YourClass`. The result will be
    `!DLROW OLLEH`.

    For `page.20` the result will be the same, but wrapped into
    a link to the page with ID 11. The result will be
    `<a href="/path/to/page/id/11">!DLROW OLLEH</a>`.

    Note how in the PHP code `$this->cObj`, the reference to the
    calling `cObject`, uses functions from
    `ContentObjectRenderer`
    class.

**postUserFuncInt**

-   **postUserFuncInt**

    -   *Type:* [function name](https://docs.typo3.org/permalink/t3tsref:data-type-function-name@main)

    > [!NOTE]
    > **Changed in version 14.0**
    >
    > PHP functions called via TypoScript **must** now use the PHP
    > attribute `#[AsAllowedCallable]`
    > (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

    Calls the provided PHP function. If you specify a function name with '->'
    it will be interpreted as a call to a class method.

    Two parameters are sent to the PHP function: a
    content variable containing the current content (this is the value that
    will be processed) and subproperties of
    `postUserFuncInt`.

    The result will be rendered non-cached outside the main
    page-rendering. See the `cObject`
    [USER_INT](https://docs.typo3.org/permalink/t3tsref:cobj-user-int@main) description.

    PHP functions called via TypoScript **must** use the PHP
    attribute `#[AsAllowedCallable]`
    (`\TYPO3\CMS\Core\Attribute\AsAllowedCallable`).

**prefixComment**

-   **prefixComment**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Prefixes content with an HTML comment. The second part of the input
    string (divided by "|") is the comment and the first part is an integer
    denoting how many trailing tabs to put in front of the comment on a new line.

    The content is parsed through [](https://docs.typo3.org/permalink/t3tsref:stdwrap-insertdata@main) `insertData`.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    prefixComment = 2 | CONTENT ELEMENT, uid:{field:uid}/{field:CType}
    ```

    Will indent the comment by 1 tab (and the next line by 2+1 tabs)

### Properties for sanitizing and caching data

**htmlSanitize**

-   **htmlSanitize**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / array with key "build"

    This property is responsible for sanitization and removal of XSS from markup. It
    strips tags, attributes and values that are not explicitly allowed.

    -   `htmlSanitize = [boolean]` \- whether to invoke sanitization
        (enabled by default when invoked by `stdWrap.parseFunc`).
    -   `htmlSanitize.build = [string]` \- defines which builder
        to use (must be an instance of `\TYPO3\HtmlSanitizer\Builder\BuilderInterface`)
        for building a `\TYPO3\HtmlSanitizer\Sanitizer` instance
        using a particular `\TYPO3\HtmlSanitizer\Behavior`. It can either be
        a fully qualified class name or the name of a preset as defined in
        `$GLOBALS['TYPO3_CONF_VARS']['SYS']['htmlSanitizer']` \- the default is
        `\TYPO3\CMS\Core\Html\DefaultSanitizerBuilder`.

    **Examples**

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10 {
        value = <div><img src="invalid.file" onerror="alert(1)"></div>
        htmlSanitize = 1
    }
    ```

    will result in the following output:

    ```html
    <div><img src="invalid.file"></div>
    ```

    The following code is equivalent to the above, but specifies a builder:

    **EXT:site_package/Configuration/Sets/Main/setup.typoscript**

    ```typoscript
    10 = TEXT
    10 {
        value = <div><img src="invalid.file" onerror="alert(1)"></div>
        htmlSanitize = 1
        // Use either "default" for the default builder
        htmlSanitize.build = default
        // or use the full class name of the default builder
        // htmlSanitize.build = TYPO3\CMS\Core\Html\DefaultSanitizerBuilder
    }
    ```

**cache**

-   **cache**

    -   *Type:* [cache](https://docs.typo3.org/permalink/t3tsref:cache@main)

    Caches rendered content in the caching framework.

### Properties for debugging data

**debug**

-   **debug**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Prints content with `HTMLSpecialChars()` and `<pre></pre>`.
    Useful for debugging the resulting value of `stdWrap`.

> [!WARNING]
> **Attention**
>
> Only use this for debugging during development, otherwise output can break.

**debugFunc**

-   **debugFunc**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Prints the content directly to the browser using the `debug()` function.

    If set to value "2" the content will be printed in a table (which looks nicer).

> [!WARNING]
> **Attention**
>
> Only use this for debugging during development, otherwise output can break.

**debugData**

-   **debugData**

    -   *Type:* [boolean](https://docs.typo3.org/permalink/t3tsref:data-type-boolean@main) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@main)

    Prints the current data-array, `$cObj->data`, directly to the browser. This
    is where `field` gets data from.

> [!WARNING]
> **Attention**
>
> Only use this for debugging during development, otherwise output can break.

## Example

Content object "[TEXT](https://docs.typo3.org/permalink/t3tsref:cobj-text@main)" containing property "value":

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
10 = TEXT
10.value = some text
10.stdWrap.case = upper
```

Here the content in object "10" is converted into uppercase before it is
returned.
