Layout.php
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Layout
- Version
- $Id: Layout.php 25263 2013-02-18 11:48:02Z frosch $
\Zend_Layout
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


\Zend_View_Helper_Placeholder_Container $_container


string $_contentKey = 'content'
'content'
Details- Type
- string


string $_helperClass = 'Zend_Layout_Controller_Action_Helper_Layout'
'Zend_Layout_Controller_Action_Helper_Layout'
Details- Type
- string


string $_inflectorTarget = ':script.:suffix'
':script.:suffix'
Details- Type
- string


bool $_mvcSuccessfulActionOnly = true
true
Details- Type
- bool


string $_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'
'Zend_Layout_Controller_Plugin_Layout'
Details- Type
- string
Methods


__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.
Name | Type | Description |
---|---|---|
$options | string | array | \Zend_Config | |
$initMvc |


__get(string $key) : mixed
Get layout variable
Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
mixed |


__isset(string $key) : bool
Is a layout variable set?
Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
bool |


__set(string $key, mixed $value) : void
Set layout variable
Name | Type | Description |
---|---|---|
$key | string | |
$value | mixed |


_initVarContainer() : \Zend_View_Helper_Placeholder_Container
Initialize placeholder container for layout vars
Type | Description |
---|---|
\Zend_View_Helper_Placeholder_Container |


_setMvcEnabled(bool $mvcEnabled) : \Zend_Layout
Set MVC enabled flag
Name | Type | Description |
---|---|---|
$mvcEnabled | bool |
Type | Description |
---|---|
\Zend_Layout |


assign(mixed $spec, mixed $value = null) : \Zend_Layout
Assign one or more layout variables
Name | Type | Description |
---|---|---|
$spec | mixed | Assoc array or string key; if assoc array, sets each key as a layout variable |
$value | mixed | Value if $spec is a key |
Type | Description |
---|---|
\Zend_Layout |
Exception | Description |
---|---|
\Zend_Layout_Exception | if non-array/string value passed to $spec |


getInflector() : \Zend_Filter_Inflector
Retrieve inflector
Type | Description |
---|---|
\Zend_Filter_Inflector |


getMvcInstance() : \Zend_Layout | null
Retrieve MVC instance of Zend_Layout object
Type | Description |
---|---|
\Zend_Layout | null |


getView() : \Zend_View_Interface
Get current view object
If no view object currently set, retrieves it from the ViewRenderer.
Type | Description |
---|---|
\Zend_View_Interface |
- Todo
- Set inflector from view renderer at same time


render(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'.
Name | Type | Description |
---|---|---|
$name | mixed |
Type | Description |
---|---|
mixed |


resetMvcInstance() : void
Reset MVC instance
Unregisters plugins and helpers, and destroys MVC layout instance.


setConfig(\Zend_Config $config) : \Zend_Layout
Set options from a config object
Name | Type | Description |
---|---|---|
$config | \Zend_Config |
Type | Description |
---|---|
\Zend_Layout |


setContentKey(string $contentKey) : \Zend_Layout
Set content key
Key in namespace container denoting default content
Name | Type | Description |
---|---|---|
$contentKey | string |
Type | Description |
---|---|
\Zend_Layout |


setHelperClass(string $helperClass) : \Zend_Layout
Set helper class
Name | Type | Description |
---|---|---|
$helperClass | string |
Type | Description |
---|---|
\Zend_Layout |


setInflector(\Zend_Filter_Inflector $inflector) : \Zend_Layout
Set inflector to use when resolving layout names
Name | Type | Description |
---|---|---|
$inflector | \Zend_Filter_Inflector |
Type | Description |
---|---|
\Zend_Layout |


setInflectorTarget(string $inflectorTarget) : \Zend_Layout
Set inflector target
Name | Type | Description |
---|---|---|
$inflectorTarget | string |
Type | Description |
---|---|
\Zend_Layout |


setLayout(string $name, boolean $enabled = true) : \Zend_Layout
Set layout script to use
Note: enables layout by default, can be disabled
Name | Type | Description |
---|---|---|
$name | string | |
$enabled | boolean |
Type | Description |
---|---|
\Zend_Layout |


setLayoutPath(string $path) : \Zend_Layout
Set layout script path
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
\Zend_Layout |


setMvcSuccessfulActionOnly(bool $successfulActionOnly) : \Zend_Layout
Set MVC Successful Action Only flag
Name | Type | Description |
---|---|---|
$successfulActionOnly | bool |
Type | Description |
---|---|
\Zend_Layout |


setOptions(array | \Zend_Config $options) : void
Set options en masse
Name | Type | Description |
---|---|---|
$options | array | \Zend_Config |


setPluginClass(string $pluginClass) : \Zend_Layout
Set plugin class
Name | Type | Description |
---|---|---|
$pluginClass | string |
Type | Description |
---|---|
\Zend_Layout |


setView(\Zend_View_Interface $view) : \Zend_Layout
Set view object
Name | Type | Description |
---|---|---|
$view | \Zend_View_Interface |
Type | Description |
---|---|
\Zend_Layout |


setViewSuffix(string $viewSuffix) : \Zend_Layout
Set layout view script suffix
Name | Type | Description |
---|---|---|
$viewSuffix | string |
Type | Description |
---|---|
\Zend_Layout |


startMvc(string | array | \Zend_Config $options = null) : \Zend_Layout
Static method for initialization with MVC support
Name | Type | Description |
---|---|---|
$options | string | array | \Zend_Config |
Type | Description |
---|---|
\Zend_Layout |