RequestUtil
in package
Table of Contents
Properties
- $requestStack : RequestStack
- $contaoFramework : ContaoFramework
Methods
- __construct() : mixed
- getBaseUrl() : string
- Get the website base url (scheme and host) considering additional context.
- getCurrentPageModel() : PageModel|null
- Return the current page model.
- getCurrentRootPageModel() : PageModel|null
- Return the root page of the current page.
- isIndexPage() : bool
- Return true if the current page (or the passed page) is the index/ start page of the current page tree.
- isNewVisitor() : bool
- Detect if user already visited our domain before.
Properties
$requestStack
protected
RequestStack
$requestStack
$contaoFramework read-only
private
ContaoFramework
$contaoFramework
Methods
__construct()
public
__construct(RequestStack $requestStack, ContaoFramework $contaoFramework) : mixed
Parameters
- $requestStack : RequestStack
- $contaoFramework : ContaoFramework
getBaseUrl()
Get the website base url (scheme and host) considering additional context.
public
getBaseUrl([PageModel, fallback?: string} $context = [] ][, array{throwException?: bool} $options = [] ]) : string
If no base url could be determined, an empty string is returned.
Context:
- pageModel: The current page model
- fallback: will be returned if no other base url could be determined
Options:
- throwException: Throw exception if no base url could be determined instead of returning empty string
Parameters
- $context : PageModel, fallback?: string} = []
-
Pass additional context. Available content: pageModel, fallback
- $options : array{throwException?: bool} = []
-
Pass addition options: Available options: throwException
Return values
stringgetCurrentPageModel()
Return the current page model.
public
getCurrentPageModel() : PageModel|null
Tags
Return values
PageModel|null —the current page model or null if no page context
getCurrentRootPageModel()
Return the root page of the current page.
public
getCurrentRootPageModel([PageModel $currentPage = null ]) : PageModel|null
Parameters
- $currentPage : PageModel = null
Return values
PageModel|null —the root page model or null if not exist
isIndexPage()
Return true if the current page (or the passed page) is the index/ start page of the current page tree.
public
isIndexPage([PageModel $pageModel = null ]) : bool
Parameters
- $pageModel : PageModel = null
Return values
boolisNewVisitor()
Detect if user already visited our domain before.
public
isNewVisitor() : bool