mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-15 15:39:31 +00:00
Merge branch 'master' into settings-bundle
This commit is contained in:
commit
8750573724
191 changed files with 27745 additions and 12133 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue