cakephp-2.0 > CakePlugin :: load()
Search Method

CakePlugin

A AbstractTransport AclBehavior AclComponent AclInterface AclNode AclShell Aco AcoAction ActionsAuthorize ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel AppShell Aro AuthComponent B BadRequestException BakeShell BakeTask BaseAuthenticate BaseAuthorize BasicAuthenticate BasicAuthentication BehaviorCollection C Cache CacheEngine CacheException CacheHelper CacheSession CakeEmail CakeErrorController CakeException CakeLog CakeLogException CakeLogInterface CakePlugin CakeRequest CakeResponse CakeRoute CakeSchema CakeSession CakeSessionException CakeSessionHandlerInterface CakeSocket ClassRegistry CommandListShell Component ComponentCollection ConfigReaderInterface Configure ConfigureException ConnectionManager ConsoleErrorHandler ConsoleException ConsoleInput ConsoleInputArgument ConsoleInputOption ConsoleInputSubcommand ConsoleOptionParser ConsoleOutput ConsoleShell ContainableBehavior Controller ControllerAuthorize ControllerTask CookieComponent CrudAuthorize D DatabaseSession DataSource DbAcl DbAclSchema DbConfigTask DboSource Debugger DebugTransport DigestAuthenticate DigestAuthentication Dispatcher E EmailComponent ErrorHandler ExceptionRenderer ExtractTask F File FileEngine FileLog FixtureTask Folder ForbiddenException FormAuthenticate FormHelper H Helper HelperCollection HelpFormatter HtmlHelper HttpException HttpResponse HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniReader InternalErrorException J JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MailTransport MediaView MemcacheEngine MethodNotAllowedException MissingActionException MissingBehaviorException MissingComponentException MissingConnectionException MissingControllerException MissingDatabaseException MissingDatasourceConfigException MissingDatasourceException MissingHelperException MissingLayoutException MissingModelException MissingPluginException MissingShellException MissingShellMethodException MissingTableException MissingTaskException MissingTestLoaderException MissingViewException Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte Mysql N NotFoundException NumberHelper O Object ObjectCollection P PagesController PagesController PaginatorComponent PaginatorHelper Permission PhpReader PluginShortRoute PluginTask Postgres PrivateActionException ProjectTask PrototypeEngineHelper R RedirectRoute RequestHandlerComponent Router RouterException RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher SmtpTransport SocketException Sqlite Sqlserver String T TaskCollection TemplateTask TestsuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior U UnauthorizedException UpgradeShell V Validation View ViewTask W WincacheEngine X XcacheEngine Xml XmlException

load

line:69 at /lib/Cake/Core/CakePlugin.php
Loads a plugin and optionally loads bootstrapping, routing files or loads a initialization function

Method

(void) public load ($plugin, $config = array())

Parameters

ParameterTypeCommentDefault
$plugin mixed required name of the plugin to be loaded in CamelCase format or array or plugins to load
$config array optional configuration options for the plugin array()

Return

void

Comment

Loads a plugin and optionally loads bootstrapping, routing files or loads a initialization function

Examples:

`CakePlugin::load('DebugKit')` will load the DebugKit plugin and will not load any bootstrap nor route files
`CakePlugin::load('DebugKit', array('bootstrap' => true, 'routes' => true))` will load the bootstrap.php and routes.php files
`CakePlugin::load('DebugKit', array('bootstrap' => false, 'routes' => true))` will load routes.php file but not bootstrap.php
`CakePlugin::load('DebugKit', array('bootstrap' => array('config1', 'config2')))` will load config1.php and config2.php files
`CakePlugin::load('DebugKit', array('bootstrap' => 'aCallableMethod'))` will run the aCallableMethod function to initialize it

Bootstrap initialization functions can be expressed as a PHP callback type, including closures. Callbacks will receive two
parameters (plugin name, plugin configuration)

It is also possible to load multiple plugins at once. Examples:

`CakePlugin::load(array('DebugKit', 'ApiGenerator'))` will load the DebugKit and ApiGenerator plugins
`CakePlugin::load(array('DebugKit', 'ApiGenerator'), array('bootstrap' => true))` will load bootstrap file for both plugins

{{{
CakePlugin::load(array(
'DebugKit' => array('routes' => true),
'ApiGenerator'
), array('bootstrap' => true))
}}}

Will only load the bootstrap for ApiGenerator and only the routes for DebugKit

@param mixed $plugin name of the plugin to be loaded in CamelCase format or array or plugins to load
@param array $config configuration options for the plugin
@throws MissingPluginException if the folder for the plugin to be loaded is not found
@return void