mirror of
https://github.com/flextype/flextype.git
synced 2025-08-07 13:46:42 +02:00
fix(expressions): fix url
expressions
This commit is contained in:
@@ -30,22 +30,24 @@ use function Flextype\getUriString;
|
||||
use function Flextype\isCurrentUrl;
|
||||
use function Flextype\redirect;
|
||||
use function Flextype\urlFor;
|
||||
use function Flextype\url;
|
||||
|
||||
class UrlExpression implements ExpressionFunctionProviderInterface
|
||||
{
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new ExpressionFunction('urlFor', static fn (string $routeName, array $data = [], array $queryParams = []) => '\Flextype\urlFor($routeName, $data, $queryParams)', static fn (string $routeName, array $data = [], array $queryParams = []) => urlFor($routeName, $data, $queryParams)),
|
||||
new ExpressionFunction('fullUrlFor', static fn (ServerRequestInterface $request, string $routeName, array $data = [], array $queryParams = []) => '\Flextype\fullUrlFor($request, $routeName, $data, $queryParams)', static fn (ServerRequestInterface $request, string $routeName, array $data = [], array $queryParams = []) => fullUrlFor($request, $routeName, $data = [], $queryParams = [])),
|
||||
new ExpressionFunction('isCurrentUrl', static fn (ServerRequestInterface $request, string $routeName, array $data = []) => '\Flextype\isCurrentUrl($request, $routeName, $data)', static fn (ServerRequestInterface $request, string $routeName, array $data = []) => isCurrentUrl($request, $routeName, $data = [])),
|
||||
new ExpressionFunction('getCurrentUrl', static fn (ServerRequestInterface $request, bool $withQueryString = false) => '\Flextype\getCurrentUrl($request, $withQueryString)', static fn (ServerRequestInterface $request, bool $withQueryString = false) => getCurrentUrl($request, $withQueryString)),
|
||||
new ExpressionFunction('url', static fn (string $string = '', string $prefix = 'base') => '\Flextype\url($string, $prefix)', static fn ($arguments, string $string = '', string $prefix = 'base') => urlFor($string, $prefix)),
|
||||
new ExpressionFunction('urlFor', static fn (string $routeName, array $data = [], array $queryParams = []) => '\Flextype\urlFor($routeName, $data, $queryParams)', static fn ($arguments, string $routeName, array $data = [], array $queryParams = []) => urlFor($routeName, $data, $queryParams)),
|
||||
new ExpressionFunction('fullUrlFor', static fn (ServerRequestInterface $request, string $routeName, array $data = [], array $queryParams = []) => '\Flextype\fullUrlFor($request, $routeName, $data, $queryParams)', static fn ($arguments, ServerRequestInterface $request, string $routeName, array $data = [], array $queryParams = []) => fullUrlFor($request, $routeName, $data = [], $queryParams = [])),
|
||||
new ExpressionFunction('isCurrentUrl', static fn (ServerRequestInterface $request, string $routeName, array $data = []) => '\Flextype\isCurrentUrl($request, $routeName, $data)', static fn ($arguments, ServerRequestInterface $request, string $routeName, array $data = []) => isCurrentUrl($request, $routeName, $data = [])),
|
||||
new ExpressionFunction('getCurrentUrl', static fn (ServerRequestInterface $request, bool $withQueryString = false) => '\Flextype\getCurrentUrl($request, $withQueryString)', static fn ($arguments, ServerRequestInterface $request, bool $withQueryString = false) => getCurrentUrl($request, $withQueryString)),
|
||||
new ExpressionFunction('getBasePath', static fn () => '\Flextype\getBasePath()', static fn () => getBasePath()),
|
||||
new ExpressionFunction('getBaseUrl', static fn () => '\Flextype\getBaseUrl()', static fn () => getBaseUrl()),
|
||||
new ExpressionFunction('getAbsoluteUrl', static fn () => '\Flextype\getAbsoluteUrl()', static fn () => getAbsoluteUrl()),
|
||||
new ExpressionFunction('getProjectUrl', static fn () => '\Flextype\getProjectUrl()', static fn () => getProjectUrl()),
|
||||
new ExpressionFunction('getUriString', static fn () => '\Flextype\getUriString()', static fn () => getUriString()),
|
||||
new ExpressionFunction('redirect', static fn (string $routeName, array $data = [], array $queryParams = [], int $status = 301) => '\Flextype\redirect($routeName, $data, $queryParams, $status)', static fn (string $routeName, array $data = [], array $queryParams = [], int $status = 301) => redirect($routeName, $data, $queryParams, $status)),
|
||||
new ExpressionFunction('redirect', static fn (string $routeName, array $data = [], array $queryParams = [], int $status = 301) => '\Flextype\redirect($routeName, $data, $queryParams, $status)', static fn ($arguments, string $routeName, array $data = [], array $queryParams = [], int $status = 301) => redirect($routeName, $data, $queryParams, $status)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user