Prototype Engine Helper for JsHelper
Provides Prototype specific JavaScript for JsHelper. Requires at least Prototype 1.6
$_callbackArguments
protected array
$_multiple
protected boolean
$_optionMap
protected array
domReady( string $functionBody )
Create a domReady event. This is a special event in many libraries
$functionBody
drag( array $options array() )
Create a Draggable element.
$options
optional array() drop( array $options array() )
Create a Droppable element.
$options
optional array() each( string $callback )
Create an iteration over the current selection result.
$callback
effect( string $name , array $options array() )
Trigger an Effect.
$name
$options
optional array() event( string $type , string $callback , array $options array() )
Add an event to the script cache. Operates on the currently selected elements.
wrap
- Whether you want the callback wrapped in an anonymous function. (defaults true)stop
- Whether you want the event to stopped. (defaults true)$type
$callback
$options
optional array() get( string $selector )
Create javascript selector for a CSS rule
$selector
PrototypeEngineHelper
request( string|array $url , array $options array() )
Create an Ajax or Ajax.Updater call.
$url
$options
optional array() serializeForm( array $options array() )
Serialize the form attached to $selector.
$options
optional array() slider( array $options array() )
Creates a slider control widget.
$options
optional array() sortable( array $options array() )
Create a sortable element.
The scriptaculous implementation of sortables does not support the 'start' and 'distance' options.
$options
optional array() _mapOptions( string $method , array $options )
Maps Abstract options to engine specific option names. If attributes are missing from the map, they are not changed.
$method
$options
_parseOptions( array $options , array $safeKeys array() )
Parse an options assoc array into a JavaScript object literal. Similar to object() but treats any non-integer value as a string, does not include { }
$options
$safeKeys
optional array() _prepareCallbacks( string $method , array $options , array $callbacks array() )
Prepare callbacks and wrap them with function ([args]) { } as defined in _callbackArgs array.
$method
$options
$callbacks
optional array() _processOptions( string $method , array $options )
Convenience wrapper method for all common option processing steps. Runs _mapOptions, _prepareCallbacks, and _parseOptions in order.
$method
$options
_toQuerystring( array $parameters )
Convert an array of data into a query string
$parameters
_utf8ToHex( string $string )
Encode a string into JSON. Converts and escapes necessary characters.
$string
alert( string $message )
Create an alert()
message in JavaScript
$message
confirm( string $message )
Create a confirm()
message
$message
confirmReturn( string $message )
Generate a confirm snippet that returns false from the current function scope.
$message
escape( string $string )
Escape a string to be JSON friendly.
List of escaped elements:
$string
object( array $data array() , array $options array() )
Generates a JavaScript object in JavaScript Object Notation (JSON) from an array. Will use native JSON encode method if available, and $useNative == true
prefix
- String prepended to the returned data.postfix
- String appended to the returned data.$data
optional array() $options
optional array() prompt( string $message , string $default '' )
Create a prompt()
JavaScript function
$message
$default
optional '' redirect( string|array $url null )
Redirects to a URL. Creates a window.location modification snippet that can be used to trigger 'redirects' from JavaScript.
$url
optional null value( mixed $val array() , boolean $quoteString null , string $key 'value' )
Converts a PHP-native variable of any type to a JSON-equivalent representation
$val
optional array() $quoteString
optional null $key
optional 'value' protected array
Contains a list of callback names -> default arguments.
array( 'slider' => array( 'onSlide' => 'value', 'onChange' => 'value', ), 'drag' => array( 'onStart' => 'event', 'onDrag' => 'event', 'change' => 'draggable', 'onEnd' => 'event', ), 'drop' => array( 'onHover' => 'draggable, droppable, event', 'onDrop' => 'draggable, droppable, event', ), 'request' => array( 'onCreate' => 'transport', 'onComplete' => 'transport', 'onFailure' => 'response, jsonHeader', 'onRequest' => 'transport', 'onSuccess' => 'response, jsonHeader' ), 'sortable' => array( 'onStart' => 'element', 'onChange' => 'element', 'onUpdate' => 'element', ), )
protected boolean
Is the current selection a multiple selection? or is it just a single element.
false
protected array
Option mappings for Prototype
array( 'request' => array( 'async' => 'asynchronous', 'data' => 'parameters', 'before' => 'onCreate', 'success' => 'onSuccess', 'complete' => 'onComplete', 'error' => 'onFailure' ), 'sortable' => array( 'sort' => 'onChange', 'complete' => 'onUpdate', ), 'drag' => array( 'snapGrid' => 'snap', 'container' => 'constraint', 'stop' => 'onEnd', 'start' => 'onStart', 'drag' => 'onDrag', ), 'drop' => array( 'hover' => 'onHover', 'drop' => 'onDrop', 'hoverClass' => 'hoverclass', ), 'slider' => array( 'direction' => 'axis', 'change' => 'onSlide', 'complete' => 'onChange', 'value' => 'sliderValue', ) )
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-PrototypeEngineHelper.html