Git Product home page Git Product logo

cakephp-giftwrap's Introduction

CakePHP-GiftWrap

Requirements

  • CakePHP >= 2.1
  • PHP 5.3+

Installation

git clone git://github.com:loadsys/CakePHP-GiftWrap.git Plugin/CakePHP-GiftWrap
echo "CakePlugin::load('CakePHP-GiftWrap', array('bootstrap' => true));" >> Config/bootstrap.php

Usage

Coming soon.

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.

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.

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.

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.

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.

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.

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.

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.

PresenterComponent::setDecorator($key, $className, $context, $extra, $options)
  • $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.

PresenterComponent::setEachDecorator($key, $className, $contexts, $extra, $options)
  • $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.

License

MIT

Copyright

Loadsys Web Strategies 2013

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.