---
title: "Callback ViewHelper <c:callback>"
manual: "SAV Charts"
version: "14.7"
source: "Reference/FluidParserViewHelpers/CallbackViewHelper/Index.rst"
rendered: "2026-09-17T13:01:15+00:00"
---

# Callback ViewHelper `<c:callback>` {#callback-viewhelper-c-callback}

ViewHelper that includes a JavaScript function.

Go to the source code of this ViewHelper:
[CallbackViewHelper.php](https://github.com/YolfTypo3/SavCharts/blob/main/Classes/ViewHelpers/CallbackViewHelper.php) (GitHub).

## Arguments {#arguments}

The following arguments are available for the callback ViewHelper:

-   **key**

    -   *Required:* true
    -   *Type:* string

    Callback key

-   **fileName**

    -   *Default:* ''
    -   *Type:* string

    File name containing the JavaScript function

## Examples {#examples}

### With fileName attribute {#with-filename-attribute}

The JavaScript function must be in the given file name.

```xml
<c:item key="tooltip">
    <c:item key="callbacks">
        <c:callback key="label" fileName="EXT:sav_charts/Resources/Public/Callbacks/TooltipLabel.js" />
    </c:item>
</c:item>
```

### Child nodes {#child-nodes}

The JavaScript function is provided in the child node.

```xml
<c:item key="tooltip">
    <c:item key="callbacks">
        <c:callback key="label">
            function(context) {
                return context.label + ' - ' + context.formattedValue + ' €';
            }
        </c:callback>
    </c:item>
</c:item>
```
