Merge branch 'master' into settings-bundle

This commit is contained in:
Jan Böhmer 2025-01-17 22:06:18 +01:00
commit 8750573724
191 changed files with 27745 additions and 12133 deletions

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
*/
namespace App\Twig;
use Symfony\Component\HttpFoundation\Request;
use App\Services\LogSystem\EventCommentType;
use Jbtronics\SettingsBundle\Proxy\SettingsProxyInterface;
use ReflectionClass;
@ -41,6 +42,7 @@ final class MiscExtension extends AbstractExtension
new TwigFunction('event_comment_needed', $this->evenCommentNeeded(...)),
new TwigFunction('settings_icon', $this->settingsIcon(...)),
new TwigFunction('uri_without_host', $this->uri_without_host(...))
];
}
@ -73,4 +75,18 @@ final class MiscExtension extends AbstractExtension
return $attribute?->newInstance()->icon;
}
/**
* Similar to the getUri function of the request, but does not contain protocol and host.
* @param Request $request
* @return string
*/
public function uri_without_host(Request $request): string
{
if (null !== $qs = $request->getQueryString()) {
$qs = '?'.$qs;
}
return $request->getBaseUrl().$request->getPathInfo().$qs;
}
}