PHP Class FOF30\View\ViewTemplateFinder

Afficher le fichier Open project: akeeba/fof Class Usage Examples

Protected Properties

Свойство Type Description
$container The container of the view, for quick reference
$defaultLayout Default layout's name (default: "default")
$defaultTpl Default subtemplate name (default: empty)
$extensions The layout template extensions to look for
$sidePrefix Which application side prefix should I use by default (site, admin, auto, any)
$strictLayout Should Should I only look for this layout or also the default layout?
$strictTpl Should I only look for the defined subtemplate or also no subtemplate?
$strictView Should I only look in the specified view (true) or also the pluralised/singularised (false)
$view The view we are attached to

Méthodes publiques

Méthode Description
__construct ( View $view, array $config = [] ) Public constructor. The config array can contain the following keys extensions array defaultLayout string defaultTpl string strictView bool strictTpl bool strictLayout bool sidePrefix string For the descriptions of each key please see the same-named property of this class
addExtension ( string $extension ) : void Add an extension to the list of view template extensions
getDefaultLayout ( ) : string Returns the default layout name
getDefaultTpl ( ) : string Returns the default subtemplate name
getExtensions ( ) : array Get the list of view template extensions
getSidePrefix ( ) : string Returns the application side prefix which will be used by default in getViewTemplateUris. It can be one of: site Public front-end admin Administrator back-end auto Automatically figure out if it should be site or admin any First look in the current application side, then look on the other side of the application
getViewTemplateUris ( array $parameters ) : array Returns a list of template URIs for a specific component, view, template and sub-template. The $parameters array can have any of the following keys: component string The name of the component, e.g. com_something view string The name of the view layout string The name of the layout tpl string The name of the subtemplate strictView bool Should I only look in the specified view, or should I look in the pluralised/singularised view as well? strictLayout bool Should I only look for this layout, or also for the default layout? strictTpl bool Should I only look for this subtemplate or also for no subtemplate? sidePrefix string The application side prefix (site, admin, auto, any)
isStrictLayout ( ) : boolean Returns the "strict layout" flag. When the flag is false we will look for a view template with both the specified and the default template name in getViewTemplateUris. When true we will only look for the specified view template.
isStrictTpl ( ) : boolean Returns the "strict template" flag. When the flag is false we will look for a view template with or without the subtemplate defined in getViewTemplateUris. If it's true we will only look for the subtemplate specified.
isStrictView ( ) : boolean Returns the "strict view" flag. When the flag is false we will look for the view template in both the singularised and pluralised view. If it's true we will only look for the view template in the view specified in getViewTemplateUris.
parseTemplateUri ( string $uri = '' ) : array Parses a template URI in the form of admin:component/view/layout to an array listing the application section (admin, site), component, view and template referenced therein.
removeExtension ( string $extension ) : void Remove an extension from the list of view template extensions
resolveUriToPath ( string $uri, string $layoutTemplate = '', array $extraPaths = [] ) : string Resolves a view template URI (e.g. any:com_foobar/Items/cheese) to an absolute filesystem path (e.g. /var/www/html/administrator/components/com_foobar/View/Items/tmpl/cheese.php)
setDefaultLayout ( string $defaultLayout ) : void Sets the default layout name
setDefaultTpl ( string $defaultTpl ) Sets the default subtemplate name
setExtensions ( array $extensions ) : void Set the list of view template extensions
setSidePrefix ( string $sidePrefix ) : void Sets the application side prefix which will be used by default in getViewTemplateUris. It can be one of: site Public front-end admin Administrator back-end auto Automatically figure out if it should be site or admin any First look in the current application side, then look on the other side of the application
setStrictLayout ( boolean $strictLayout ) : void Sets the "strict layout" flag. When the flag is false we will look for a view template with both the specified and the default template name in getViewTemplateUris. When true we will only look for the specified view template.
setStrictTpl ( boolean $strictTpl ) : void Sets the "strict template" flag. When the flag is false we will look for a view template with or without the subtemplate defined in getViewTemplateUris. If it's true we will only look for the subtemplate specified.
setStrictView ( boolean $strictView ) : void Sets the "strict view" flag. When the flag is false we will look for the view template in both the singularised and pluralised view. If it's true we will only look for the view template in the view specified in getViewTemplateUris.

Method Details

__construct() public méthode

Public constructor. The config array can contain the following keys extensions array defaultLayout string defaultTpl string strictView bool strictTpl bool strictLayout bool sidePrefix string For the descriptions of each key please see the same-named property of this class
public __construct ( View $view, array $config = [] )
$view View The view we are attached to
$config array The configuration for this view template finder

addExtension() public méthode

Add an extension to the list of view template extensions
public addExtension ( string $extension ) : void
$extension string
Résultat void

getDefaultLayout() public méthode

Returns the default layout name
public getDefaultLayout ( ) : string
Résultat string

getDefaultTpl() public méthode

Returns the default subtemplate name
public getDefaultTpl ( ) : string
Résultat string

getExtensions() public méthode

Get the list of view template extensions
public getExtensions ( ) : array
Résultat array

getSidePrefix() public méthode

Returns the application side prefix which will be used by default in getViewTemplateUris. It can be one of: site Public front-end admin Administrator back-end auto Automatically figure out if it should be site or admin any First look in the current application side, then look on the other side of the application
public getSidePrefix ( ) : string
Résultat string

getViewTemplateUris() public méthode

Returns a list of template URIs for a specific component, view, template and sub-template. The $parameters array can have any of the following keys: component string The name of the component, e.g. com_something view string The name of the view layout string The name of the layout tpl string The name of the subtemplate strictView bool Should I only look in the specified view, or should I look in the pluralised/singularised view as well? strictLayout bool Should I only look for this layout, or also for the default layout? strictTpl bool Should I only look for this subtemplate or also for no subtemplate? sidePrefix string The application side prefix (site, admin, auto, any)
public getViewTemplateUris ( array $parameters ) : array
$parameters array See above
Résultat array

isStrictLayout() public méthode

Returns the "strict layout" flag. When the flag is false we will look for a view template with both the specified and the default template name in getViewTemplateUris. When true we will only look for the specified view template.
public isStrictLayout ( ) : boolean
Résultat boolean

isStrictTpl() public méthode

Returns the "strict template" flag. When the flag is false we will look for a view template with or without the subtemplate defined in getViewTemplateUris. If it's true we will only look for the subtemplate specified.
public isStrictTpl ( ) : boolean
Résultat boolean

isStrictView() public méthode

Returns the "strict view" flag. When the flag is false we will look for the view template in both the singularised and pluralised view. If it's true we will only look for the view template in the view specified in getViewTemplateUris.
public isStrictView ( ) : boolean
Résultat boolean

parseTemplateUri() public méthode

Parses a template URI in the form of admin:component/view/layout to an array listing the application section (admin, site), component, view and template referenced therein.
public parseTemplateUri ( string $uri = '' ) : array
$uri string The template path to parse
Résultat array A hash array with the parsed path parts. Keys: admin, component, view, template

removeExtension() public méthode

Remove an extension from the list of view template extensions
public removeExtension ( string $extension ) : void
$extension string
Résultat void

resolveUriToPath() public méthode

Resolves a view template URI (e.g. any:com_foobar/Items/cheese) to an absolute filesystem path (e.g. /var/www/html/administrator/components/com_foobar/View/Items/tmpl/cheese.php)
public resolveUriToPath ( string $uri, string $layoutTemplate = '', array $extraPaths = [] ) : string
$uri string The view template URI to parse
$layoutTemplate string The layout template override of the View class
$extraPaths array Any extra lookup paths where we'll be looking for this view template
Résultat string

setDefaultLayout() public méthode

Sets the default layout name
public setDefaultLayout ( string $defaultLayout ) : void
$defaultLayout string
Résultat void

setDefaultTpl() public méthode

Sets the default subtemplate name
public setDefaultTpl ( string $defaultTpl )
$defaultTpl string

setExtensions() public méthode

Set the list of view template extensions
public setExtensions ( array $extensions ) : void
$extensions array
Résultat void

setSidePrefix() public méthode

Sets the application side prefix which will be used by default in getViewTemplateUris. It can be one of: site Public front-end admin Administrator back-end auto Automatically figure out if it should be site or admin any First look in the current application side, then look on the other side of the application
public setSidePrefix ( string $sidePrefix ) : void
$sidePrefix string
Résultat void

setStrictLayout() public méthode

Sets the "strict layout" flag. When the flag is false we will look for a view template with both the specified and the default template name in getViewTemplateUris. When true we will only look for the specified view template.
public setStrictLayout ( boolean $strictLayout ) : void
$strictLayout boolean
Résultat void

setStrictTpl() public méthode

Sets the "strict template" flag. When the flag is false we will look for a view template with or without the subtemplate defined in getViewTemplateUris. If it's true we will only look for the subtemplate specified.
public setStrictTpl ( boolean $strictTpl ) : void
$strictTpl boolean
Résultat void

setStrictView() public méthode

Sets the "strict view" flag. When the flag is false we will look for the view template in both the singularised and pluralised view. If it's true we will only look for the view template in the view specified in getViewTemplateUris.
public setStrictView ( boolean $strictView ) : void
$strictView boolean
Résultat void

Property Details

$container protected_oe property

The container of the view, for quick reference
protected $container

$defaultLayout protected_oe property

Default layout's name (default: "default")
protected $defaultLayout

$defaultTpl protected_oe property

Default subtemplate name (default: empty)
protected $defaultTpl

$extensions protected_oe property

The layout template extensions to look for
protected $extensions

$sidePrefix protected_oe property

Which application side prefix should I use by default (site, admin, auto, any)
protected $sidePrefix

$strictLayout protected_oe property

Should Should I only look for this layout or also the default layout?
protected $strictLayout

$strictTpl protected_oe property

Should I only look for the defined subtemplate or also no subtemplate?
protected $strictTpl

$strictView protected_oe property

Should I only look in the specified view (true) or also the pluralised/singularised (false)
protected $strictView

$view protected_oe property

The view we are attached to
protected $view