---
title: "CreateYoutubeUriViewHelper"
manual: "Events2"
version: "main"
permalink: "https://docs.typo3.org/permalink/jweiland/events2:youtubeviewhelper@main"
source: "AdministratorManual/Templates/ViewHelpers/CreateYoutubeUrlViewHelper.rst"
rendered: "2026-11-23T08:41:16+00:00"
---

# CreateYoutubeUriViewHelper {#youtubeviewhelper}

The ViewHelper `e2:createYoutubeUri` searches the given link for the
YouTube ID and returns the embedded YouTube link of this ID.

Link: `https://www.youtube.com/watch?v=B5gDI2h0F20`

YouTube ID: `B5gDI2h0F20`

Embedded link: `//www.youtube.com/embed/B5gDI2h0F20`

<!-- TODO: no Markdown rendering for "versionchanged" -->

The argument link is optional. If it is not set, the tag content
is used, so the ViewHelper can be used in inline syntax.

## Arguments of the CreateYoutubeUriViewHelper {#youtubeviewhelper-arguments}

-   **`link`**

    The YouTube link or the YouTube ID. If not set, the tag content is
    used.

## Example for the CreateYoutubeUriViewHelper {#youtubeviewhelper-example}

**EXT:my_sitepackage/Resources/Private/Templates/Video/Show.html (excerpt)**

```html
{namespace e2=JWeiland\Events2\ViewHelpers}

<iframe width="560"
        height="315"
        src="{e2:createYoutubeUri(link: event.videoLink.link)}"
        allowfullscreen></iframe>

<!-- Inline syntax -->
<iframe width="560"
        height="315"
        src="{event.videoLink.link -> e2:createYoutubeUri()}"
        allowfullscreen></iframe>
```
