Layout.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Layout  
Version
$Id$  

\Zend_Layout

Package: Zend_Layout
Provide Layout support for MVC applications
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_View_Helper_Placeholder_Container $_container
Placeholder container for layout variables
>VPropertyprotectedstring $_contentKey = 'content'
Key used to store content from 'default' named response segment
Default value'content'Details
Type
string
>VPropertyprotectedbool $_enabled = true
Are layouts enabled?
Default valuetrueDetails
Type
bool
>VPropertyprotectedstring $_helperClass = 'Zend_Layout_Controller_Action_Helper_Layout'
Helper class
Default value'Zend_Layout_Controller_Action_Helper_Layout'Details
Type
string
>VPropertyprotected\Zend_Filter_Inflector $_inflector
Inflector used to resolve layout script
>VPropertyprotectedbool $_inflectorEnabled = true
Flag: is inflector enabled?
Default valuetrueDetails
Type
bool
>VPropertyprotectedstring $_inflectorTarget = ':script.:suffix'
Inflector target
Default value':script.:suffix'Details
Type
string
>VPropertyprotectedstring $_layout = 'layout'
Layout view
Default value'layout'Details
Type
string
>VPropertyprotectedbool $_mvcEnabled = true
Flag: is MVC integration enabled?
Default valuetrueDetails
Type
bool
>VPropertyprotected\Zend_Layout $_mvcInstance
static
Instance registered with MVC, if any
Details
Type
\Zend_Layout
>VPropertyprotectedbool $_mvcSuccessfulActionOnly = true
Flag: is MVC successful action only flag set?
Default valuetrueDetails
Type
bool
>VPropertyprotectedstring $_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'
Plugin class
Default value'Zend_Layout_Controller_Plugin_Layout'Details
Type
string
>VPropertyprotected\Zend_View_Interface $_view
>VPropertyprotected$_viewBasePath = null
Default valuenullDetails
Type
n/a
>VPropertyprotected$_viewBasePrefix = 'Layout_View'
Default value'Layout_View'Details
Type
n/a
>VPropertyprotectedstring $_viewScriptPath = null
Layout view script path
Default valuenullDetails
Type
string
>VPropertyprotectedstring $_viewSuffix = 'phtml'
View script suffix for layout script
Default value'phtml'Details
Type
string

Methods

methodpublic__construct(string | array | \Zend_Config $options = null,  $initMvc = false) : void

Constructor

Accepts either: - A string path to layouts - An array of options - A Zend_Config object with options Layout script path, either as argument or as key in options, is required. If mvcEnabled flag is false from options, simply sets layout script path. Otherwise, also instantiates and registers action helper and controller plugin.
Parameters
NameTypeDescription
$optionsstring | array | \Zend_Config
$initMvc
methodpublic__get(string $key) : mixed

Get layout variable

Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
mixed
methodpublic__isset(string $key) : bool

Is a layout variable set?

Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
bool
methodpublic__set(string $key, mixed $value) : void

Set layout variable

Parameters
NameTypeDescription
$keystring
$valuemixed
methodpublic__unset(string $key) : void

Unset a layout variable?

Parameters
NameTypeDescription
$keystring
methodprotected_initHelper() : void

Initialize action helper

methodprotected_initMvc() : void

Initialize MVC integration

methodprotected_initPlugin() : void

Initialize front controller plugin

methodprotected_initVarContainer() : \Zend_View_Helper_Placeholder_Container

Initialize placeholder container for layout vars

methodprotected_setMvcEnabled(bool $mvcEnabled) : \Zend_Layout

Set MVC enabled flag

Parameters
NameTypeDescription
$mvcEnabledbool
Returns
TypeDescription
\Zend_Layout
methodpublicassign(mixed $spec, mixed $value = null) : \Zend_Layout

Assign one or more layout variables

Parameters
NameTypeDescription
$specmixed

Assoc array or string key; if assoc array, sets each key as a layout variable

$valuemixed

Value if $spec is a key

Returns
TypeDescription
\Zend_Layout
Throws
ExceptionDescription
\Zend_Layout_Exceptionif non-array/string value passed to $spec
methodpublicdisableInflector() : \Zend_Layout

Disable inflector

Returns
TypeDescription
\Zend_Layout
methodpublicdisableLayout() : \Zend_Layout

Disable layout

Returns
TypeDescription
\Zend_Layout
methodpublicenableInflector() : \Zend_Layout

Enable inflector

Returns
TypeDescription
\Zend_Layout
methodpublicenableLayout() : \Zend_Layout

Enable layout

Returns
TypeDescription
\Zend_Layout
methodpublicgetContentKey() : string

Retrieve content key

Returns
TypeDescription
string
methodpublicgetHelperClass() : string

Retrieve helper class

Returns
TypeDescription
string
methodpublicgetInflector() : \Zend_Filter_Inflector

Retrieve inflector

Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicgetInflectorTarget() : string

Retrieve inflector target

Returns
TypeDescription
string
methodpublicgetLayout() : string

Get current layout script

Returns
TypeDescription
string
methodpublicgetLayoutPath() : string

Get current layout script path

Returns
TypeDescription
string
methodpublicgetMvcEnabled() : bool

Retrieve MVC enabled flag

Returns
TypeDescription
bool
methodpublicgetMvcInstance() : \Zend_Layout | null
static

Retrieve MVC instance of Zend_Layout object

Returns
TypeDescription
\Zend_Layout | null
methodpublicgetMvcSuccessfulActionOnly() : bool

Get MVC Successful Action Only Flag

Returns
TypeDescription
bool
methodpublicgetPluginClass() : string

Retrieve plugin class

Returns
TypeDescription
string
methodpublicgetView() : \Zend_View_Interface

Get current view object

If no view object currently set, retrieves it from the ViewRenderer.
Returns
TypeDescription
\Zend_View_Interface
Details
Todo
Set inflector from view renderer at same time  
methodpublicgetViewBasePath() : void

methodpublicgetViewScriptPath() : void

methodpublicgetViewSuffix() : string

Retrieve layout view script suffix

Returns
TypeDescription
string
methodpublicinflectorEnabled() : bool

Return status of inflector enabled flag

Returns
TypeDescription
bool
methodpublicisEnabled() : bool

Is layout enabled?

Returns
TypeDescription
bool
methodpublicrender(mixed $name = null) : mixed

Render layout

Sets internal script path as last path on script path stack, assigns layout variables to view, determines layout name using inflector, and renders layout view script. $name will be passed to the inflector as the key 'script'.
Parameters
NameTypeDescription
$namemixed
Returns
TypeDescription
mixed
methodpublicresetMvcInstance() : void
static

Reset MVC instance

Unregisters plugins and helpers, and destroys MVC layout instance.
methodpublicsetConfig(\Zend_Config $config) : \Zend_Layout

Set options from a config object

Parameters
NameTypeDescription
$config\Zend_Config
Returns
TypeDescription
\Zend_Layout
methodpublicsetContentKey(string $contentKey) : \Zend_Layout

Set content key

Key in namespace container denoting default content
Parameters
NameTypeDescription
$contentKeystring
Returns
TypeDescription
\Zend_Layout
methodpublicsetHelperClass(string $helperClass) : \Zend_Layout

Set helper class

Parameters
NameTypeDescription
$helperClassstring
Returns
TypeDescription
\Zend_Layout
methodpublicsetInflector(\Zend_Filter_Inflector $inflector) : \Zend_Layout

Set inflector to use when resolving layout names

Parameters
NameTypeDescription
$inflector\Zend_Filter_Inflector
Returns
TypeDescription
\Zend_Layout
methodpublicsetInflectorTarget(string $inflectorTarget) : \Zend_Layout

Set inflector target

Parameters
NameTypeDescription
$inflectorTargetstring
Returns
TypeDescription
\Zend_Layout
methodpublicsetLayout(string $name, boolean $enabled = true) : \Zend_Layout

Set layout script to use

Note: enables layout by default, can be disabled
Parameters
NameTypeDescription
$namestring
$enabledboolean
Returns
TypeDescription
\Zend_Layout
methodpublicsetLayoutPath(string $path) : \Zend_Layout

Set layout script path

Parameters
NameTypeDescription
$pathstring
Returns
TypeDescription
\Zend_Layout
methodpublicsetMvcSuccessfulActionOnly(bool $successfulActionOnly) : \Zend_Layout

Set MVC Successful Action Only flag

Parameters
NameTypeDescription
$successfulActionOnlybool
Returns
TypeDescription
\Zend_Layout
methodpublicsetOptions(array | \Zend_Config $options) : void

Set options en masse

Parameters
NameTypeDescription
$optionsarray | \Zend_Config
methodpublicsetPluginClass(string $pluginClass) : \Zend_Layout

Set plugin class

Parameters
NameTypeDescription
$pluginClassstring
Returns
TypeDescription
\Zend_Layout
methodpublicsetView(\Zend_View_Interface $view) : \Zend_Layout

Set view object

Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
\Zend_Layout
methodpublicsetViewBasePath( $path,  $prefix = 'Layout_View') : void

Parameters
NameTypeDescription
$path
$prefix
methodpublicsetViewScriptPath( $path) : void

Parameters
NameTypeDescription
$path
methodpublicsetViewSuffix(string $viewSuffix) : \Zend_Layout

Set layout view script suffix

Parameters
NameTypeDescription
$viewSuffixstring
Returns
TypeDescription
\Zend_Layout
methodpublicstartMvc(string | array | \Zend_Config $options = null) : \Zend_Layout
static

Static method for initialization with MVC support

Parameters
NameTypeDescription
$optionsstring | array | \Zend_Config
Returns
TypeDescription
\Zend_Layout
Documentation was generated by phpDocumentor 2.2.0 .