FileLayout

Extends \Joomla\CMS\Layout\BaseLayout

Base class for rendering a display layout loaded from from a layout file

link

https://docs.joomla.org/Special:MyLanguage/Sharing_layouts_across_views_or_extensions_with_JLayout

since

3.0

Methods

__construct

Method to instantiate the file-based layout.

__construct(string $layoutId, string $basePath = null, mixed $options = null) 
since

3.0

Arguments

$layoutId

stringDot separated path to the layout file, relative to base path

$basePath

stringBase path to use when loading layout files

$options

mixedOptional custom options to load. Registry or array format [@since 3.2]

addDebugMessage

Add a debug message to the debug messages array

addDebugMessage(string $message) : self
inherited
since

3.2

Arguments

$message

stringMessage to save

Response

self

addIncludePath

Add one path to include in layout search. Proxy of addIncludePaths()

addIncludePath(string $path) : self
since

3.2

Arguments

$path

stringThe path to search for layouts

Response

self

addIncludePaths

Add one or more paths to include in layout search

addIncludePaths(string $paths) : self
since

3.2

Arguments

$paths

stringThe path or array of paths to search for layouts

Response

self

clearDebugMessages

Clear the debug messages array

clearDebugMessages() : self
inherited
since

3.5

Response

self

clearIncludePaths

Clear the include paths

clearIncludePaths() : self
since

3.5

Response

self

debug

Render a layout with debug info

debug(mixed $data = array()) : string
inherited
since

3.5

Arguments

$data

mixedData passed to the layout

Response

string

escape

Method to escape output.

escape(string $output) : string
inherited
note

the ENT_COMPAT flag will be replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes

since

3.0

Arguments

$output

stringThe output to escape.

Response

stringThe escaped output.

get

Method to get the value from the data array

get(string $key, mixed $defaultValue = null) : mixed
inherited
since

3.5

Arguments

$key

stringKey to search for in the data array

$defaultValue

mixedDefault value to return if the key is not set

Response

mixedValue from the data array | defaultValue if doesn't exist

getData

Get the data being rendered

getData() : array
inherited
since

3.5

Response

array

getDebugMessages

Get the debug messages array

getDebugMessages() : array
inherited
since

3.2

Response

array

getDefaultIncludePaths

Get the default array of include paths

getDefaultIncludePaths() : array
since

3.5

Response

array

getIncludePaths

Get the active include paths

getIncludePaths() : array
since

3.5

Response

array

getLayoutId

Get the active layout id

getLayoutId() : string
since

3.5

Response

string

getOptions

Get the options

getOptions() : \Joomla\Registry\Registry
inherited
since

3.2

Response

\Joomla\Registry\RegistryObject with the options

getPath

Method to finds the full real file path, checking possible overrides

getPath() : string
since

3.0

Response

stringThe full path to the layout file

getSuffixes

Get the active suffixes

getSuffixes() : array
since

3.5

Response

array

isDebugEnabled

Check if debug mode is enabled

isDebugEnabled() : boolean
inherited
since

3.5

Response

boolean

loadLanguageSuffixes

Load the automatically generated language suffixes.

loadLanguageSuffixes() : self

Example: array('es-ES', 'es', 'ltr')

since

3.5

Response

self

loadVersionSuffixes

Load the automatically generated version suffixes.

loadVersionSuffixes() : self

Example: array('j311', 'j31', 'j3')

since

3.5

Response

self

refreshIncludePaths

Refresh the list of include paths

refreshIncludePaths() : self
deprecated
since

3.2

deprecated

3.5 Use FileLayout::clearIncludePaths()

Response

self

removeIncludePath

Remove one path from the layout search

removeIncludePath(string $path) : self
since

3.2

Arguments

$path

stringThe path to remove from the layout search

Response

self

removeIncludePaths

Remove one or more paths to exclude in layout search

removeIncludePaths(string $paths) : self
since

3.2

Arguments

$paths

stringThe path or array of paths to remove for the layout search

Response

self

render

Method to render the layout.

render(array $displayData) : string
inherited
since

3.0

Arguments

$displayData

arrayArray of properties available for use inside the layout file to build the displayed output

Response

stringThe necessary HTML to display the layout

renderDebugMessages

Render the list of debug messages

renderDebugMessages() : string
inherited
since

3.2

Response

stringOutput text/HTML code

resetOptions

Function to empty all the options

resetOptions() : \Joomla\CMS\Layout\BaseLayout
inherited
since

3.2

Response

\Joomla\CMS\Layout\BaseLayoutInstance of $this to allow chaining.

set

Method to set a value in the data array. Example: $layout->set('items', $items);

set(string $key, mixed $value) : self
inherited
since

3.5

Arguments

$key

stringKey for the data array

$value

mixedValue to assign to the key

Response

self

setClient

Function to initialise the application client

setClient(mixed $client) : void
since

3.2

Arguments

$client

mixedFrontend: 'site' or 0 | Backend: 'admin' or 1

setComponent

Method to change the component where search for layouts

setComponent(string $option) : mixed
since

3.2

Arguments

$option

stringURL Option of the component. Example: com_content

Response

mixedComponent option string | null for none

setData

Set the the data passed the layout

setData(array $data) : self
inherited
since

3.5

Arguments

$data

arrayArray with the data for the layout

Response

self

setDebug

Change the debug mode

setDebug(boolean $debug) : self
inherited
since

3.5

Arguments

$debug

booleanEnable / Disable debug

Response

self

setIncludePaths

Set the include paths to search for layouts

setIncludePaths(array $paths) : self
since

3.5

Arguments

$paths

arrayArray with paths to search in

Response

self

setLayout

Change the layout

setLayout(string $layoutId) : self
deprecated
since

3.2

deprecated

3.5 Use setLayoutId()

Arguments

$layoutId

stringLayout to render

Response

self

setLayoutId

Set the active layout id

setLayoutId(string $layoutId) : self
since

3.5

Arguments

$layoutId

stringLayout identifier

Response

self

setOptions

Set the options

setOptions(array|\Joomla\Registry\Registry $options = null) : \Joomla\CMS\Layout\BaseLayout
inherited
since

3.2

Arguments

$options

array|\Joomla\Registry\RegistryArray / Registry object with the options to load

Response

\Joomla\CMS\Layout\BaseLayoutInstance of $this to allow chaining.

setSuffixes

Set suffixes to search layouts

setSuffixes(mixed $suffixes) : self
since

3.5

Arguments

$suffixes

mixedString with a single suffix or 'auto' | 'none' or array of suffixes

Response

self

sublayout

Render a layout with the same include paths & options

sublayout(string $layoutId, mixed $displayData) : string
since

3.2

Arguments

$layoutId

stringThe identifier for the sublayout to be searched in a subfolder with the name of the current layout

$displayData

mixedData to be rendered

Response

stringThe necessary HTML to display the layout

validComponent

Validate that the active component is valid

validComponent(string $option = null) : boolean
since

3.2

Arguments

$option

stringURL Option of the component. Example: com_content

Response

boolean

Properties

cache

Cached layout paths

static
since

3.5

Type(s)

array

layoutId

Dot separated path to the layout file, relative to base path

since

3.0

Type(s)

string

basePath

Base path to use when loading layout files

since

3.0

Type(s)

string

fullPath

Full path to actual layout files, after possible template override check

since

3.0.3

Type(s)

string

includePaths

Paths to search for layouts

since

3.2

Type(s)

array

options

Options object

inherited
since

3.2

Type(s)

\Joomla\Registry\Registry

data

Data for the layout

inherited
since

3.5

Type(s)

array

debugMessages

Debug information messages

inherited
since

3.2

Type(s)

array