View/Helper/HeadScript.php
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_View
- Subpackage
- Helper
- Version
- $Id$
\Zend_View_Helper_HeadScript
Package: Zend_View\Helper




Returns
Throws





Returns



Helper for setting and retrieving script elements for HTML head section
- Parent(s)
- \Zend_View_Helper_Placeholder_Container_Standalone < \Zend_View_Helper_Abstract
- Children
- \Zend_View_Helper_InlineScript
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
Constants
Properties

bool $_arbitraryAttributes = falseAre arbitrary attributes allowed?
Default value
falseDetails- Type
- bool

array $_optionalAttributes = array('charset', 'defer', 'language', 'src')Optional allowed attributes for script tag
Default value
array('charset', 'defer', 'language', 'src')Details- Type
- array

string $_regKey = 'Zend_View_Helper_HeadScript'Registry key for placeholder
Default value
'Zend_View_Helper_HeadScript'Details- Type
- string

string $_requiredAttributes = array('type')Required attributes for script tag
Default value
array('type')Details- Type
- string
Methods

__call(string $method, array $args) : \Zend_View_Helper_HeadScriptOverload method access
Allows the following method calls:
- appendFile($src, $type = 'text/javascript', $attrs = array())
- offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array())
- prependFile($src, $type = 'text/javascript', $attrs = array())
- setFile($src, $type = 'text/javascript', $attrs = array())
- appendScript($script, $type = 'text/javascript', $attrs = array())
- offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array())
- prependScript($script, $type = 'text/javascript', $attrs = array())
- setScript($script, $type = 'text/javascript', $attrs = array())
Parameters| Name | Type | Description |
|---|---|---|
| $method | string | |
| $args | array |
| Type | Description |
|---|---|
| \Zend_View_Helper_HeadScript |
| Exception | Description |
|---|---|
| \Zend_View_Exception | if too few arguments or invalid method |

_isDuplicate(string $file) : boolIs the file specified a duplicate?
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $file | string |
| Type | Description |
|---|---|
| bool |

_isValid(mixed $value) : boolIs the script provided valid?
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $value | mixed |
| Type | Description |
|---|---|
| bool |

captureStart(mixed $captureType = \Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $type = 'text/javascript', $attrs = array()) : voidStart capture action
Parameters
| Name | Type | Description |
|---|---|---|
| $captureType | mixed | |
| $type | ||
| $attrs |

createData(string $type, array $attributes, string $content = null) : \stdClassCreate data item containing all necessary components of script
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $type | string | |
| $attributes | array | |
| $content | string |
| Type | Description |
|---|---|
| \stdClass |

headScript(string $mode = \Zend_View_Helper_HeadScript::FILE, string $spec = null, string $placement = 'APPEND', array $attrs = array(), string $type = 'text/javascript') : \Zend_View_Helper_HeadScriptReturn headScript object
Returns headScript helper object; optionally, allows specifying a script
or script file to include.
Parameters| Name | Type | Description |
|---|---|---|
| $mode | string | Script or file |
| $spec | string | Script/url |
| $placement | string | Append, prepend, or set |
| $attrs | array | Array of script attributes |
| $type | string | Script type and/or array of script attributes |
| Type | Description |
|---|---|
| \Zend_View_Helper_HeadScript |

itemToString( $item, string | int $indent, $escapeStart, $escapeEnd) : stringCreate script HTML
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $item | ||
| $indent | string | int | |
| $escapeStart | ||
| $escapeEnd |
| Type | Description |
|---|---|
| string |

offsetSet(string | int $index, mixed $value) : voidOverride offsetSet
Parameters
| Name | Type | Description |
|---|---|---|
| $index | string | int | |
| $value | mixed |

setAllowArbitraryAttributes(bool $flag) : \Zend_View_Helper_HeadScriptSet flag indicating if arbitrary attributes are allowed
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_View_Helper_HeadScript |