feat: remove easy admin bundle, adopt admin theme
This commit is contained in:
@@ -33,6 +33,7 @@ class AppExtension extends AbstractExtension
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('icon', [AppRuntime::class, 'renderIcon'], ['needs_environment' => true, 'is_safe' => ['html']]),
|
||||
new TwigFunction('is_participant_eligible', [AppRuntime::class, 'isParticipantEligible']),
|
||||
new TwigFunction('qa_attribute', [AppRuntime::class, 'renderQaAttribute'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('is_static_text', [AppRuntime::class, 'isStaticText']),
|
||||
@@ -42,6 +43,7 @@ class AppExtension extends AbstractExtension
|
||||
new TwigFunction('booking_theme', [AppRuntime::class, 'getBookingTheme']),
|
||||
new TwigFunction('gtm_id', [AppRuntime::class, 'getGtmId']),
|
||||
new TwigFunction('cmp_url', [AppRuntime::class, 'getCmpUrl']),
|
||||
new TwigFunction('return_url', [AppRuntime::class, 'getEncodedReturnUrl']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Model\DomainConfig;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\RuntimeExtensionInterface;
|
||||
use Twig\Extra\Intl\IntlExtension;
|
||||
|
||||
@@ -148,6 +149,14 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
return sprintf(' data-qa-%s="%s"', strtolower($label), $value);
|
||||
}
|
||||
|
||||
public function renderIcon(Environment $environment, string $icon, string $classes = 'w-5 h-5'): string
|
||||
{
|
||||
return $environment->render('_partials/_icon.html.twig', [
|
||||
'icon' => $icon,
|
||||
'class' => $classes,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a form field should be rendered as static text.
|
||||
*
|
||||
@@ -268,6 +277,17 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
return $this->getDomainConfig()->cmpUrl;
|
||||
}
|
||||
|
||||
public function getEncodedReturnUrl(): string
|
||||
{
|
||||
$masterRequest = $this->requestStack->getMainRequest();
|
||||
|
||||
if (null === $masterRequest) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return rawurlencode($masterRequest->getRequestUri());
|
||||
}
|
||||
|
||||
private function getDomainConfig(): DomainConfig
|
||||
{
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
Reference in New Issue
Block a user