rector.php gets the PHP sets up to 8.5. Mostly constructor promotion with readonly properties, typed class constants, ??=, arrow functions, str_contains/str_starts_with, catch without unused variables, array_any and #[\Override] on overridden properties; array_key_exists() keys are cast to string (null keys are deprecated in PHP 8.5). Long promoted constructor signatures are wrapped one parameter per line. Checked locally: a crawl of ~1,900 frontend URLs over all sites and the backchannel APIs (/api/hotel, /api/product, content feed manifest and records of every type) render the same as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace EP\EpTheme\ViewHelpers\Uri;
|
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
class VideoViewHelper extends AbstractViewHelper
|
|
{
|
|
/**
|
|
* @var bool
|
|
*/
|
|
#[\Override]
|
|
protected $escapeOutput = false;
|
|
|
|
public function initializeArguments()
|
|
{
|
|
parent::initializeArguments();
|
|
|
|
$this->registerArgument('value', 'string', 'The video url', true);
|
|
$this->registerArgument('layout', 'int', 'The layout', false, 1);
|
|
}
|
|
|
|
/**
|
|
* @param array $arguments
|
|
* @param \Closure $renderChildrenClosure
|
|
* @param RenderingContextInterface $renderingContext
|
|
* @return mixed
|
|
*/
|
|
public function render()
|
|
{
|
|
// YouTube
|
|
if ((int) $this->arguments['layout'] === 0) {
|
|
return $this->arguments['value'] . '?rel=0&controls=0&showinfo=0';
|
|
}
|
|
// Vimeo
|
|
if ((int) $this->arguments['layout'] === 1) {
|
|
return sprintf('https://player.vimeo.com/video/%d?html5=1', $this->arguments['value']);
|
|
}
|
|
return '';
|
|
}
|
|
|
|
}
|