Contao Utils Bundle

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

$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
string

getCurrentPageModel()

Return the current page model.

public getCurrentPageModel() : PageModel|null
Tags
See

AbstractContentElementController::getPageModel()

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
bool

isNewVisitor()

Detect if user already visited our domain before.

public isNewVisitor() : bool
Return values
bool
Loading…
On this page

Search results