MooTools Engine Helper for JsHelper
Provides MooTools specific JavaScript for JsHelper. Assumes that you have the following MooTools packages
$_callbackArguments
protected array
$_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.
Requires the Drag
plugin from MootoolsMore
$options
optional array() drop( array $options array() )
Create a Droppable element.
Requires the Drag
and Drag.Move
plugins from MootoolsMore
Droppables in Mootools function differently from other libraries. Droppables are implemented as an extension of Drag. So in addition to making a get() selection for the droppable element. You must also provide a selector rule to the draggable element. Furthermore, Mootools droppables inherit all options from Drag.
$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.
$type
$callback
$options
optional array() get( string $selector )
Create javascript selector for a CSS rule
$selector
MootoolsEngineHelper
request( string|array $url , array $options array() )
Create a new Request.
Requires Request
. If you wish to use 'update' key you must have Request.HTML
if you wish to do Json requests you will need JSON
and Request.JSON
.
$url
$options
optional array() serializeForm( array $options array() )
Serialize the form attached to $selector.
$options
optional array() slider( array $options array() )
Create a slider control
Requires Slider
from MootoolsMore
$options
optional array() sortable( array $options array() )
Create a sortable element.
Requires the Sortables
plugin from MootoolsMore
$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( 'onTick' => 'position', 'onChange' => 'step', 'onComplete' => 'event' ), 'request' => array( 'onRequest' => '', 'onComplete' => '', 'onCancel' => '', 'onSuccess' => 'responseText, responseXML', 'onFailure' => 'xhr', 'onException' => 'headerName, value', ), 'drag' => array( 'onBeforeStart' => 'element', 'onStart' => 'element', 'onSnap' => 'element', 'onDrag' => 'element, event', 'onComplete' => 'element, event', 'onCancel' => 'element', ), 'drop' => array( 'onBeforeStart' => 'element', 'onStart' => 'element', 'onSnap' => 'element', 'onDrag' => 'element, event', 'onComplete' => 'element, event', 'onCancel' => 'element', 'onDrop' => 'element, droppable, event', 'onLeave' => 'element, droppable', 'onEnter' => 'element, droppable', ), 'sortable' => array( 'onStart' => 'element, clone', 'onSort' => 'element, clone', 'onComplete' => 'element', ) )
protected array
Option mappings for MooTools
array( 'request' => array( 'complete' => 'onComplete', 'success' => 'onSuccess', 'before' => 'onRequest', 'error' => 'onFailure' ), 'sortable' => array( 'distance' => 'snap', 'containment' => 'constrain', 'sort' => 'onSort', 'complete' => 'onComplete', 'start' => 'onStart', ), 'drag' => array( 'snapGrid' => 'snap', 'start' => 'onStart', 'drag' => 'onDrag', 'stop' => 'onComplete', ), 'drop' => array( 'drop' => 'onDrop', 'hover' => 'onEnter', 'leave' => 'onLeave', ), 'slider' => array( 'complete' => 'onComplete', 'change' => 'onChange', 'direction' => 'mode', 'step' => 'steps' ) )
© 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-MootoolsEngineHelper.html