API Documentation

Zend/Layout.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Layout  
Version
$Id: Layout.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Layout

Package: Zend\Layout

Provide Layout support for MVC applications

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotected\Zend_View_Helper_Placeholder_Container  $_container= ''

Placeholder container for layout variables

Propertyprotectedstring  $_contentKey= ''content''

Key used to store content from 'default' named response segment

Default value'content'Details
Type
string
Propertyprotectedbool  $_enabled= 'true'

Are layouts enabled?

Default valuetrueDetails
Type
bool
Propertyprotectedstring  $_helperClass= ''Zend_Layout_Controller_Action_Helper_Layout''

Helper class

Default value'Zend_Layout_Controller_Action_Helper_Layout'Details
Type
string
Propertyprotected\Zend_Filter_Inflector  $_inflector= ''

Inflector used to resolve layout script

Details
Type
\Zend_Filter_Inflector
Propertyprotectedbool  $_inflectorEnabled= 'true'

Flag: is inflector enabled?

Default valuetrueDetails
Type
bool
Propertyprotectedstring  $_inflectorTarget= '':script.:suffix''

Inflector target

Default value':script.:suffix'Details
Type
string
Propertyprotectedstring  $_layout= ''layout''

Layout view

Default value'layout'Details
Type
string
Propertyprotectedbool  $_mvcEnabled= 'true'

Flag: is MVC integration enabled?

Default valuetrueDetails
Type
bool
Propertyprotected\Zend_Layout  $_mvcInstance= ''
static

Instance registered with MVC, if any

Details
Type
\Zend_Layout
Propertyprotectedbool  $_mvcSuccessfulActionOnly= 'true'

Flag: is MVC successful action only flag set?

Default valuetrueDetails
Type
bool
Propertyprotectedstring  $_pluginClass= ''Zend_Layout_Controller_Plugin_Layout''

Plugin class

Default value'Zend_Layout_Controller_Plugin_Layout'Details
Type
string
Propertyprotected\Zend_View_Interface  $_view= ''

Details
Type
\Zend_View_Interface
Propertyprotected  $_viewBasePath= 'null'
Default valuenullDetails
Type
Propertyprotected  $_viewBasePrefix= ''Layout_View''
Default value'Layout_View'Details
Type
Propertyprotectedstring  $_viewScriptPath= 'null'

Layout view script path

Default valuenullDetails
Type
string
Propertyprotectedstring  $_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
Name Type Description
$options string|array|\Zend_Config
$initMvc
methodpublic__get( string $key ) : mixed

Get layout variable

Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublic__isset( string $key ) : bool

Is a layout variable set?

Parameters
Name Type Description
$key string
Returns
Type Description
bool
methodpublic__set( string $key, mixed $value ) : void

Set layout variable

Parameters
Name Type Description
$key string
$value mixed
methodpublic__unset( string $key ) : void

Unset a layout variable?

Parameters
Name Type Description
$key string
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

Returns
Type Description
\Zend_View_Helper_Placeholder_Container
methodprotected_setMvcEnabled( bool $mvcEnabled ) : \Zend_Layout

Set MVC enabled flag

Parameters
Name Type Description
$mvcEnabled bool
Returns
Type Description
\Zend_Layout
methodpublicassign( mixed $spec, mixed $value = null ) : \Zend_Layout

Assign one or more layout variables

Parameters
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

Returns
Type Description
\Zend_Layout
Throws
Exception Description
\Zend_Layout_Exception if non-array/string value passed to $spec
methodpublicdisableInflector( ) : \Zend_Layout

Disable inflector

Returns
Type Description
\Zend_Layout
methodpublicdisableLayout( ) : \Zend_Layout

Disable layout

Returns
Type Description
\Zend_Layout
methodpublicenableInflector( ) : \Zend_Layout

Enable inflector

Returns
Type Description
\Zend_Layout
methodpublicenableLayout( ) : \Zend_Layout

Enable layout

Returns
Type Description
\Zend_Layout
methodpublicgetContentKey( ) : string

Retrieve content key

Returns
Type Description
string
methodpublicgetHelperClass( ) : string

Retrieve helper class

Returns
Type Description
string
methodpublicgetInflector( ) : \Zend_Filter_Inflector

Retrieve inflector

Returns
Type Description
\Zend_Filter_Inflector
methodpublicgetInflectorTarget( ) : string

Retrieve inflector target

Returns
Type Description
string
methodpublicgetLayout( ) : string

Get current layout script

Returns
Type Description
string
methodpublicgetLayoutPath( ) : string

Get current layout script path

Returns
Type Description
string
methodpublicgetMvcEnabled( ) : bool

Retrieve MVC enabled flag

Returns
Type Description
bool
methodpublicgetMvcInstance( ) : \Zend_Layout|null
static

Retrieve MVC instance of Zend_Layout object

Returns
Type Description
\Zend_Layout|null
methodpublicgetMvcSuccessfulActionOnly( ) : bool

Get MVC Successful Action Only Flag

Returns
Type Description
bool
methodpublicgetPluginClass( ) : string

Retrieve plugin class

Returns
Type Description
string
methodpublicgetView( ) : \Zend_View_Interface

Get current view object

If no view object currently set, retrieves it from the ViewRenderer.

Returns
Type Description
\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
Type Description
string
methodpublicinflectorEnabled( ) : bool

Return status of inflector enabled flag

Returns
Type Description
bool
methodpublicisEnabled( ) : bool

Is layout enabled?

Returns
Type Description
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
Name Type Description
$name mixed
Returns
Type Description
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
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_Layout
methodpublicsetContentKey( string $contentKey ) : \Zend_Layout

Set content key

Key in namespace container denoting default content

Parameters
Name Type Description
$contentKey string
Returns
Type Description
\Zend_Layout
methodpublicsetHelperClass( string $helperClass ) : \Zend_Layout

Set helper class

Parameters
Name Type Description
$helperClass string
Returns
Type Description
\Zend_Layout
methodpublicsetInflector( \Zend_Filter_Inflector $inflector ) : \Zend_Layout

Set inflector to use when resolving layout names

Parameters
Name Type Description
$inflector \Zend_Filter_Inflector
Returns
Type Description
\Zend_Layout
methodpublicsetInflectorTarget( string $inflectorTarget ) : \Zend_Layout

Set inflector target

Parameters
Name Type Description
$inflectorTarget string
Returns
Type Description
\Zend_Layout
methodpublicsetLayout( string $name, boolean $enabled = true ) : \Zend_Layout

Set layout script to use

Note: enables layout by default, can be disabled

Parameters
Name Type Description
$name string
$enabled boolean
Returns
Type Description
\Zend_Layout
methodpublicsetLayoutPath( string $path ) : \Zend_Layout

Set layout script path

Parameters
Name Type Description
$path string
Returns
Type Description
\Zend_Layout
methodpublicsetMvcSuccessfulActionOnly( bool $successfulActionOnly ) : \Zend_Layout

Set MVC Successful Action Only flag

Parameters
Name Type Description
$successfulActionOnly bool
Returns
Type Description
\Zend_Layout
methodpublicsetOptions( array|\Zend_Config $options ) : void

Set options en masse

Parameters
Name Type Description
$options array|\Zend_Config
methodpublicsetPluginClass( string $pluginClass ) : \Zend_Layout

Set plugin class

Parameters
Name Type Description
$pluginClass string
Returns
Type Description
\Zend_Layout
methodpublicsetView( \Zend_View_Interface $view ) : \Zend_Layout

Set view object

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_Layout
methodpublicsetViewBasePath(  $path,  $prefix = 'Layout_View' ) : void

Parameters
Name Type Description
$path
$prefix
methodpublicsetViewScriptPath(  $path ) : void

Parameters
Name Type Description
$path
methodpublicsetViewSuffix( string $viewSuffix ) : \Zend_Layout

Set layout view script suffix

Parameters
Name Type Description
$viewSuffix string
Returns
Type Description
\Zend_Layout
methodpublicstartMvc( string|array|\Zend_Config $options = null ) : \Zend_Layout
static

Static method for initialization with MVC support

Parameters
Name Type Description
$options string|array|\Zend_Config
Returns
Type Description
\Zend_Layout
Documentation was generated by DocBlox 0.15.1.