Loader
Class to initialize the framework.
$loader = new \CEKW\WpPlugin\Loader(__FILE__);
$loader
->addServices([
...
])
->bootstrap();
- Full name:
\CEKW\WpPlugin\Loader
Table of contents
Properties
| Name | Type | Description |
|---|---|---|
| restRouteCollection | \CEKW\WpPlugin\RestRouteCollection | Â |
| routeCollection | \Symfony\Component\Routing\RouteCollection | Â |
| serviceInstances | array | Instances of classes defined in Loader::addServices(). |
| pluginFile | string | The filename of the plugin including the path. |
| injector | \Auryn\Injector | Injector instance that can be overriden. |
Methods
__construct
Loader::__construct(string pluginFile, \Auryn\Injector injector = new Injector())
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pluginFile | string | Â |
| injector | \Auryn\Injector | Â |
addServices
Instantiates custom service classes of this plugin and prepares them for autowiring.
Loader::addServices(array services): self
Parameters:
| Parameter | Type | Description |
|---|---|---|
| services | array | Â |
Returns: self
bootstrap
Bootstraps the framework and sets up all the hooks. Should be the final method called.
Loader::bootstrap(): void
Returns: void
getUrlGenerator
Returns the UrlGenerator for use in other plugins or themes.
Loader::getUrlGenerator(): \Symfony\Component\Routing\Generator\UrlGenerator
Returns: \Symfony\Component\Routing\Generator\UrlGenerator
See:
\Symfony\Component\Routing\Generator\UrlGenerator
registerHooks
Callback that registers all hooks in service classes that implement HookSubscriberInterface and adding their hooks via Action or Filter attributes.
Loader::registerHooks(): void
Returns: void
See:
\CEKW\WpPlugin\HookSubscriberInterface
collectRestRoutes
Collects all REST routes from service classes extending AbstractRestController and using the RestRoute attribute so that they can be displayed in DebugRestRouterCommand.
Loader::collectRestRoutes(): void
Returns: void
See:
\CEKW\WpPlugin\AbstractRestController
registerRestRoutes
Callback that registers all routes collected in RestRouteCollection.
Loader::registerRestRoutes(): void
Returns: void
See:
\CEKW\WpPlugin\RestRouteCollection
registerRoutes
Callback that registers all routes from service classes extending AbstractController and using the Route attribute.
Loader::registerRoutes(): void
Returns: void
See:
\CEKW\WpPlugin\AbstractController
registerCliCommands
Registers all commands in service classes that implement CommandInterface.
Loader::registerCliCommands(): void
Returns: void
See:
\CEKW\WpPlugin\CommandInterface