Helpers collection is used as a registry for loaded helpers and handles loading and constructing helper class objects.
__get( string $name )
Provide public read access to the loaded objects
$name
mixed
ObjectCollection::__get()
__isset( string $helper )
Tries to lazy load a helper based on its name, if it cannot be found in the application folder, then it tries looking under the current plugin if any
$helper
boolean
MissingHelperException
ObjectCollection::__isset()
implementedEvents( )
Returns a list of all events that will fire in the View during it's lifecycle.
array
CakeEventListener::implementedEvents()
load( string $helper , array $settings array() )
Loads/constructs a helper. Will return the instance in the registry if it already exists. By setting $enable
to false you can disable callbacks for a helper. Alternatively you can set $settings['enabled'] = false
to disable callbacks. This alias is provided so that when declaring $helpers arrays you can disable callbacks on helpers.
You can alias your helper as an existing helper by setting the 'className' key, i.e.,
public $helpers = array( 'Html' => array( 'className' => 'AliasedHtml' ); );
All calls to the Html
helper would use AliasedHtml
instead.
$helper
$settings
optional array() Helper
MissingHelperException
trigger( string|CakeEvent $callback , array $params array() , array $options array() )
Trigger a callback method on every object in the collection. Used to trigger methods on objects in the collection. Will fire the methods in the order they were attached.
breakOn
Set to the value or values you want the callback propagation to stop on. Can either be a scalar value, or an array of values to break on. Defaults to false
.break
Set to true to enabled breaking. When a trigger is broken, the last returned value will be returned. If used in combination with collectReturn
the collected results will be returned. Defaults to false
.collectReturn
Set to true to collect the return of each object into an array. This array of return values will be returned from the trigger() call. Defaults to false
.modParams
Allows each object the callback gets called on to modify the parameters to the next object. Setting modParams to an integer value will allow you to modify the parameter with that index. Any non-null value will modify the parameter index indicated. Defaults to false.CakeEvent
$callback
Model.afterSave
event will trigger the afterSave
callback)$params
optional array() $options
optional array() mixed
CakeException
ObjectCollection::trigger()
attached( string $name null )
Gets the list of attached objects, or, whether the given object is attached
$name
optional null mixed
disable( string|array $name )
Disables callbacks on an object or array of objects. Public object methods are still callable as normal.
$name
enable( string|array $name , boolean $prioritize true )
Enables callbacks on an object or array of objects
$name
$prioritize
optional true enabled( string $name null )
Gets the list of currently-enabled objects, or, the current status of a single objects
$name
optional null mixed
loaded( string $name null )
Gets the list of loaded objects, or, whether the given object is loaded
$name
optional null mixed
normalizeObjectArray( array $objects )
Normalizes an object array, creates an array that makes lazy loading easier
$objects
array
prioritize( )
Prioritize list of enabled object
array
set( string $name null , Object $object null )
Adds or overwrites an instantiated object to the collection
$name
optional null Object
$object
optional null array
setPriority( string|array $name , integer|null $priority null )
Set priority for an object or array of objects
$name
$priority
optional null unload( string $name )
Name of the object to remove from the collection
$name
© 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.
http://api.cakephp.org/2.7/class-HelperCollection.html