CakePHP-GiftWrap
, (*1)
Requirements
Installation
Git
git clone git@github.com:loadsys/CakePHP-GiftWrap.git Plugin/GiftWrap
Composer
- Add to your
composer.json
file
"require": {
"loadsys/cakephp_giftwrap": "dev-master"
}
Usage
- Ensure the plugin is loaded in
app/Config/bootstrap.php
by calling CakePlugin::load('GiftWrap', array('bootstrap' => true));
- @TODO Complete this section
API
Component API
PresenterComponent::uses($className)
-
$className String Class name with or without the Presenter part.
Set the class that will be used for the default presenter., (*2)
PresenterComponent::viewVar($varName)
-
$varName String Variable name that the default presenter will be set to.
Set the name of the variable the defautl presenter will be set into., (*3)
PresenterComponent::defaultClass($className)
-
$className String Class name with or without the Presenter part.
Set the class that will be used as a fallback if the conventionally named presenter classes don't exist., (*4)
PresenterComponent::options($options)
-
$options Array
- contextKey String Which property of the Presenter will be the context. Default is
model
.
Set the options array that will be passed to the creation of the default presenter., (*5)
PresenterComponent::create($className, $data, $options)
-
$className String Class name with or without the Presenter part.
-
$data Mixed Data passed to the creation of the presenter.
-
$options Array Options passed to the creation of the presenter.
Creates a new instance of the supplied presenter class name with the given data and options., (*6)
PresenterComponent::set($keyOrArray, $value)
-
$keyOrArray Mixed Either a string key or an array of key/value pairs.
-
$value Mixed Value set when first param is a string key.
Set data for the default presenter by either passing a key and value, or an array of key/value pairs., (*7)
PresenterComponent::setPresenter($key, $className, $data, $options)
-
$key String Property on default presenter to set object to.
-
$className String Class name with or without the Presenter part.
-
$data Array Data for the new presenter instance.
-
$options Array Options for the new presenter instance.
Creates an instance of the supplied presenter class name with the data and options and sets it to the key on the default presenter., (*8)
PresenterComponent::setEachPresenter($key, $className, $array, $options)
-
$key String Property on default presenter to set object to.
-
$className String Class name with or without the Presenter part.
-
$array Array List of data, that each element is wrapped with a presenter.
-
$options Array Options for the new presenter instance.
Creates an iterator that wraps the supplied array. Each element of the array becomes an instance of the supplied presenter class name, where the data is the current element of the array and the options apply to all instances., (*9)
-
$key String Property on default presenter to set object to.
-
$className String Class name with or without the Presenter part.
-
$context Mixed Data that is set the the contextKey property on the presenter.
-
$extra Array Data for the new presenter instance.
-
$options Array Options for the new presenter instance.
Creates an instance of the supplied presenter class name. The $context
variable is set to the context property of the presenter, and the $extra
data is used when creating the presenter., (*10)
-
$key String Property on default presenter to set object to.
-
$className String Class name with or without the Presenter part.
-
$contexts Array List of data that is set to the presenters contextKey property.
-
$extra Array Data for the new presenter instance.
-
$options Array Options for the new presenter instance.
Creates an iterator that wraps the contexts. Each context becomes an instance of the supplied presenter class name. The presenter is created with the data supplied in $extra
, and the context is set to the context property on the presenter instance., (*11)
License
MIT, (*12)
Copyright
Loadsys Web Strategies 2013, (*13)