YouTubeHelper

class \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\YouTubeHelper

Extends
AbstractOEmbedHelper

Youtube helper class

Table of Contents

Properties

$extension  : string
File extension bind to the OnlineMedia helper
$onlineMediaIdCache  : array
Cached OnlineMediaIds [fileUid => id]

Methods

__construct()  : mixed
Constructor
getMetaData()  : array
Get meta data for OnlineMedia item Using the meta data from oEmbed
getOnlineMediaId()  : string
Get Online Media item id
getPreviewImage()  : string
Get local absolute file path to preview image
getPublicUrl()  : string|null
Get public url
transformUrlToFile()  : File|null
Try to transform given URL to a File
createNewFile()  : File
Create new OnlineMedia item container file.
findExistingFileByOnlineMediaId()  : File|null
Search for files with same onlineMediaId by content hash in indexed storage
getFileIndexRepository()  : FileIndexRepository
Returns an instance of the FileIndexRepository
getOEmbedData()  : array|null
Get OEmbed data
getOEmbedUrl()  : string
Get oEmbed url to retrieve oEmbed data
getResourceFactory()  : ResourceFactory
Returns the ResourceFactory
getTempFolderPath()  : string
Get temporary folder path to save preview images.
transformMediaIdToFile()  : File
Transform mediaId to File

Properties

$extension

File extension bind to the OnlineMedia helper

protected string $extension = ''

$onlineMediaIdCache

Cached OnlineMediaIds [fileUid => id]

protected array $onlineMediaIdCache = []

Methods

__construct()

Constructor

public __construct(string $extension) : mixed

Parameters

$extension : string

file extension bind to the OnlineMedia helper

getMetaData()

Get meta data for OnlineMedia item Using the meta data from oEmbed

public getMetaData(File $file) : array

Parameters

$file : File

Return values

array —

with metadata

getOnlineMediaId()

Get Online Media item id

public getOnlineMediaId(File $file) : string

Parameters

$file : File

Return values

string

getPreviewImage()

Get local absolute file path to preview image

public getPreviewImage(File $file) : string

Parameters

$file : File

Return values

string

getPublicUrl()

Get public url

public getPublicUrl(File $file) : string|null

Parameters

$file : File

Return values

string|null

transformUrlToFile()

Try to transform given URL to a File

public transformUrlToFile(string $url, Folder $targetFolder) : File|null

Parameters

$url : string
$targetFolder : Folder

Return values

File|null

createNewFile()

Create new OnlineMedia item container file.

protected createNewFile(Folder $targetFolder, string $fileName, string $onlineMediaId) : File

This is created inside typo3temp/ and then moved from FAL to the proper storage.

Parameters

$targetFolder : Folder
$fileName : string
$onlineMediaId : string

Return values

File

findExistingFileByOnlineMediaId()

Search for files with same onlineMediaId by content hash in indexed storage

protected findExistingFileByOnlineMediaId(string $onlineMediaId, Folder $targetFolder, string $fileExtension) : File|null

Parameters

$onlineMediaId : string
$targetFolder : Folder
$fileExtension : string

Return values

File|null

getOEmbedData()

Get OEmbed data

protected getOEmbedData(string $mediaId) : array|null

Parameters

$mediaId : string

Return values

array|null

getOEmbedUrl()

Get oEmbed url to retrieve oEmbed data

protected getOEmbedUrl(string $mediaId[, string $format = 'json' ]) : string

Parameters

$mediaId : string
$format : string = 'json'

Return values

string

getTempFolderPath()

Get temporary folder path to save preview images.

protected getTempFolderPath() : string

In composer-mode with TYPO3 installations, this needs to be put under public/ In the future this should be handled via processed file objects.

Return values

string

transformMediaIdToFile()

Transform mediaId to File

protected transformMediaIdToFile(string $mediaId, Folder $targetFolder, string $fileExtension) : File

Parameters

$mediaId : string
$targetFolder : Folder
$fileExtension : string

Return values

File
On this page