957. Class

957.1. Zend\View\Helper\HeadScript

Helper for setting and retrieving script elements for HTML head section

957.1.1. Methods

957.1.1.1. __construct

__construct()

Constructor

Set separator to PHP_EOL.

957.1.1.2. __invoke

__invoke()

Return headScript object

Returns headScript helper object; optionally, allows specifying a script or script file to include.

Parameters:
  • string – Script or file
  • string – Script/url
  • string – Append, prepend, or set
  • array – Array of script attributes
  • string – Script type and/or array of script attributes
Return type:

ZendViewHelperHeadScript

957.1.1.3. captureStart

captureStart()

Start capture action

Parameters:
  • mixed – Type of capture
  • string – Type of script
  • array – Attributes of capture
Return type:

void

Throws :

ExceptionRuntimeException

957.1.1.4. captureEnd

captureEnd()

End capture action and store

Return type:void

957.1.1.5. __call

__call()

Overload 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:
  • string – Method to call
  • array – Arguments of method
Return type:

ZendViewHelperHeadScript

Throws :

ExceptionBadMethodCallException if too few arguments or invalid method

957.1.1.6. isDuplicate

isDuplicate()

Is the file specified a duplicate?

Parameters:string – Name of file to check
Return type:bool

957.1.1.7. isValid

isValid()

Is the script provided valid?

Parameters:mixed – Is the given script valid?
Return type:bool

957.1.1.8. append

append()

Override append

Parameters:string – Append script or file
Return type:void
Throws :ExceptionInvalidArgumentException

957.1.1.9. prepend

prepend()

Override prepend

Parameters:string – Prepend script or file
Return type:void
Throws :ExceptionInvalidArgumentException

957.1.1.10. set

set()

Override set

Parameters:string – Set script or file
Return type:void
Throws :ExceptionInvalidArgumentException

957.1.1.11. offsetSet

offsetSet()

Override offsetSet

Parameters:
  • string|int – Set script of file offset
  • mixed
Return type:

void

Throws :

ExceptionInvalidArgumentException

957.1.1.12. setAllowArbitraryAttributes

setAllowArbitraryAttributes()

Set flag indicating if arbitrary attributes are allowed

Parameters:bool – Set flag
Return type:ZendViewHelperHeadScript

957.1.1.13. arbitraryAttributesAllowed

arbitraryAttributesAllowed()

Are arbitrary attributes allowed?

Return type:bool

957.1.1.14. itemToString

itemToString()

Create script HTML

Parameters:
  • mixed – Item to convert
  • string – String to add before the item
  • string – Starting sequence
  • string – Ending sequence
Return type:

string

957.1.1.15. toString

toString()

Retrieve string representation

Parameters:string|int – Amount of whitespaces or string to use for indention
Return type:string

957.1.1.16. createData

createData()

Create data item containing all necessary components of script

Parameters:
  • string – Type of data
  • array – Attributes of data
  • string – Content of data
Return type:

stdClass

957.1.2. Constants

957.1.2.1. FILE

957.1.2.2. SCRIPT