PHP Class Contao\PageModel

Inheritance: extends Model
Mostra file Open project: contao/core-bundle Class Usage Examples

Protected Properties

Property Type Description
$blnDetailsLoaded boolean Details loaded
$strTable string Table name

Public Methods

Method Description
find403ByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null Find an error 403 page by its parent ID
find404ByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null Find an error 404 page by its parent ID
findByAliases ( array $arrAliases, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Find pages matching a list of possible alias names
findFirstActiveByMemberGroups ( string $arrIds ) : PageModel | null Find the first active page by its member groups
findFirstPublishedByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null Find the first published page by its parent ID
findFirstPublishedRegularByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null Find the first published regular page by its parent ID
findFirstPublishedRootByHostAndLanguage ( string $strHost, mixed $varLanguage, array $arrOptions = [] ) : PageModel | null Find the first published root page by its host name and language
findParentsById ( integer $intId ) : Collection | PageModel[] | PageModel | null Find the parent pages of a page
findPublishedById ( integer $intId, array $arrOptions = [] ) : PageModel | null Find a published page by its ID
findPublishedByIdOrAlias ( mixed $varId, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Find published pages by their ID or aliases
findPublishedByPid ( integer $intPid, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Find published pages by their PID
findPublishedFallbackByHostname ( string $strHost, array $arrOptions = [] ) : PageModel | null Find the language fallback page by hostname
findPublishedRegularWithoutGuestsByIds ( integer $arrIds, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Find all published regular pages by their IDs and exclude pages only visible for guests
findPublishedRegularWithoutGuestsByPid ( integer $intPid, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Find all published regular pages by their parent IDs and exclude pages only visible for guests
findPublishedRootPages ( array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null Finds the published root pages
findPublishedSubpagesWithoutGuestsByPid ( integer $intPid, boolean $blnShowHidden = false, boolean $blnIsSitemap = false ) : Collection | PageModel[] | PageModel | null Find all published subpages by their parent ID and exclude pages only visible for guests
findWithDetails ( integer $intId ) : PageModel | null Find a page by its ID and return it with the inherited details
getAbsoluteUrl ( string $strParams = null ) : string Generate an absolute URL depending on the current rewriteURL setting
getFrontendUrl ( string $strParams = null, string $strForceLang = null ) : string Generate a front end URL
loadDetails ( ) : PageModel Get the details of a page including inherited parameters
onRegister ( Registry $registry ) Register the contao.dns-fallback alias when the model is attached to the registry
onUnregister ( Registry $registry ) Unregister the contao.dns-fallback alias when the model is detached from the registry

Private Methods

Method Description
applyLegacyLogic ( string $strUrl, string $strParams ) : string Modifies a URL from the URL generator.

Method Details

find403ByPid() public static method

Find an error 403 page by its parent ID
public static find403ByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null
$intPid integer The parent page's ID
$arrOptions array An optional options array
return PageModel | null The model or null if there is no 403 page

find404ByPid() public static method

Find an error 404 page by its parent ID
public static find404ByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null
$intPid integer The parent page's ID
$arrOptions array An optional options array
return PageModel | null The model or null if there is no 404 page

findByAliases() public static method

Find pages matching a list of possible alias names
public static findByAliases ( array $arrAliases, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$arrAliases array An array of possible alias names
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findFirstActiveByMemberGroups() public static method

Find the first active page by its member groups
public static findFirstActiveByMemberGroups ( string $arrIds ) : PageModel | null
$arrIds string An array of member group IDs
return PageModel | null The model or null if there is no matching member group

findFirstPublishedByPid() public static method

Find the first published page by its parent ID
public static findFirstPublishedByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null
$intPid integer The parent page's ID
$arrOptions array An optional options array
return PageModel | null The model or null if there is no published page

findFirstPublishedRegularByPid() public static method

Find the first published regular page by its parent ID
public static findFirstPublishedRegularByPid ( integer $intPid, array $arrOptions = [] ) : PageModel | null
$intPid integer The parent page's ID
$arrOptions array An optional options array
return PageModel | null The model or null if there is no published regular page

findFirstPublishedRootByHostAndLanguage() public static method

Find the first published root page by its host name and language
public static findFirstPublishedRootByHostAndLanguage ( string $strHost, mixed $varLanguage, array $arrOptions = [] ) : PageModel | null
$strHost string The host name
$varLanguage mixed An ISO language code or an array of ISO language codes
$arrOptions array An optional options array
return PageModel | null The model or null if there is no matching root page

findParentsById() public static method

Find the parent pages of a page
public static findParentsById ( integer $intId ) : Collection | PageModel[] | PageModel | null
$intId integer The page's ID
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no parent pages

findPublishedById() public static method

Find a published page by its ID
public static findPublishedById ( integer $intId, array $arrOptions = [] ) : PageModel | null
$intId integer The page ID
$arrOptions array An optional options array
return PageModel | null The model or null if there is no published page

findPublishedByIdOrAlias() public static method

Find published pages by their ID or aliases
public static findPublishedByIdOrAlias ( mixed $varId, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$varId mixed The numeric ID or the alias name
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findPublishedByPid() public static method

Find published pages by their PID
public static findPublishedByPid ( integer $intPid, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$intPid integer The parent ID
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findPublishedFallbackByHostname() public static method

Find the language fallback page by hostname
public static findPublishedFallbackByHostname ( string $strHost, array $arrOptions = [] ) : PageModel | null
$strHost string The hostname
$arrOptions array An optional options array
return PageModel | null The model or null if there is not fallback page

findPublishedRegularWithoutGuestsByIds() public static method

Find all published regular pages by their IDs and exclude pages only visible for guests
public static findPublishedRegularWithoutGuestsByIds ( integer $arrIds, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$arrIds integer An array of page IDs
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findPublishedRegularWithoutGuestsByPid() public static method

Find all published regular pages by their parent IDs and exclude pages only visible for guests
public static findPublishedRegularWithoutGuestsByPid ( integer $intPid, array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$intPid integer The parent page's ID
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findPublishedRootPages() public static method

Finds the published root pages
public static findPublishedRootPages ( array $arrOptions = [] ) : Collection | PageModel[] | PageModel | null
$arrOptions array An optional options array
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no parent pages

findPublishedSubpagesWithoutGuestsByPid() public static method

Find all published subpages by their parent ID and exclude pages only visible for guests
public static findPublishedSubpagesWithoutGuestsByPid ( integer $intPid, boolean $blnShowHidden = false, boolean $blnIsSitemap = false ) : Collection | PageModel[] | PageModel | null
$intPid integer The parent page's ID
$blnShowHidden boolean If true, hidden pages will be included
$blnIsSitemap boolean If true, the sitemap settings apply
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages

findWithDetails() public static method

Find a page by its ID and return it with the inherited details
public static findWithDetails ( integer $intId ) : PageModel | null
$intId integer The page's ID
return PageModel | null The model or null if there is no matching page

getAbsoluteUrl() public method

Generate an absolute URL depending on the current rewriteURL setting
public getAbsoluteUrl ( string $strParams = null ) : string
$strParams string An optional string of URL parameters
return string An absolute URL that can be used in the front end

getFrontendUrl() public method

Generate a front end URL
public getFrontendUrl ( string $strParams = null, string $strForceLang = null ) : string
$strParams string An optional string of URL parameters
$strForceLang string Force a certain language
return string An URL that can be used in the front end

loadDetails() public method

Get the details of a page including inherited parameters
public loadDetails ( ) : PageModel
return PageModel The page model

onRegister() public method

Register the contao.dns-fallback alias when the model is attached to the registry
public onRegister ( Registry $registry )
$registry Contao\Model\Registry The model registry

onUnregister() public method

Unregister the contao.dns-fallback alias when the model is detached from the registry
public onUnregister ( Registry $registry )
$registry Contao\Model\Registry The model registry

Property Details

$blnDetailsLoaded protected_oe property

Details loaded
protected bool $blnDetailsLoaded
return boolean

$strTable protected_oe static_oe property

Table name
protected static string $strTable
return string