Ferdinand Kuhl
6908aad70c
All checks were successful
ci/woodpecker/push/code-style Pipeline was successful
35 lines
995 B
PHP
35 lines
995 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DigiComp\FlowWebManifestUtils\ViewHelpers;
|
|
|
|
use Neos\Flow\Annotations as Flow;
|
|
use Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper;
|
|
|
|
class WebManifestViewHelper extends AbstractTagBasedViewHelper
|
|
{
|
|
protected $tagName = 'link';
|
|
|
|
/**
|
|
* @Flow\InjectConfiguration(package="DigiComp.FlowWebManifestUtils", path="reactOnPath")
|
|
* @var string
|
|
*/
|
|
protected string $reactOnPath;
|
|
|
|
public function initializeArguments()
|
|
{
|
|
parent::initializeArguments();
|
|
$this->registerArgument('useCredentials', 'bool', 'does the manifest requires authentication');
|
|
}
|
|
|
|
public function render(): string
|
|
{
|
|
if ($this->arguments['useCredentials'] === true) {
|
|
$this->tag->addAttribute('crossorigin', 'use-credentials');
|
|
}
|
|
$this->tag->addAttribute('rel', 'manifest');
|
|
$this->tag->addAttribute('href', $this->reactOnPath);
|
|
return $this->tag->render();
|
|
}
|
|
}
|