Zend Framework
3.0
|
Plugin manager implementation for translation loaders. More...
Public Member Functions | |||||||||||||
validate ($plugin) | |||||||||||||
Validate the plugin. | |||||||||||||
validatePlugin ($plugin) | |||||||||||||
Validate the plugin is of the expected type (v2). | |||||||||||||
Public Member Functions inherited from AbstractPluginManager | |||||||||||||
__construct ($configInstanceOrParentLocator=null, array $config=[]) | |||||||||||||
Constructor. | |||||||||||||
configure (array $config) | |||||||||||||
Override configure() to validate service instances. | |||||||||||||
get ($name, array $options=null) | |||||||||||||
| |||||||||||||
validate ($instance) | |||||||||||||
Validate an instance.
| |||||||||||||
setServiceLocator (ContainerInterface $container) | |||||||||||||
Implemented for backwards compatibility only. | |||||||||||||
Public Member Functions inherited from ServiceManager | |||||||||||||
__construct (array $config=[]) | |||||||||||||
Constructor. | |||||||||||||
getServiceLocator () | |||||||||||||
Implemented for backwards compatibility with previous plugin managers only. | |||||||||||||
get ($name) | |||||||||||||
| |||||||||||||
build ($name, array $options=null) | |||||||||||||
Build a service by its name, using optional options (such services are NEVER cached).
| |||||||||||||
has ($name) | |||||||||||||
| |||||||||||||
setAllowOverride ($flag) | |||||||||||||
Indicate whether or not the instance is immutable. | |||||||||||||
getAllowOverride () | |||||||||||||
Retrieve the flag indicating immutability status. | |||||||||||||
configure (array $config) | |||||||||||||
Configure the service manager. | |||||||||||||
setAlias ($alias, $target) | |||||||||||||
Add an alias. | |||||||||||||
setInvokableClass ($name, $class=null) | |||||||||||||
Add an invokable class mapping. | |||||||||||||
setFactory ($name, $factory) | |||||||||||||
Specify a factory for a given service name. | |||||||||||||
mapLazyService ($name, $class=null) | |||||||||||||
Create a lazy service mapping to a class. | |||||||||||||
addAbstractFactory ($factory) | |||||||||||||
Add an abstract factory for resolving services. | |||||||||||||
addDelegator ($name, $factory) | |||||||||||||
Add a delegator for a given service. | |||||||||||||
addInitializer ($initializer) | |||||||||||||
Add an initializer. | |||||||||||||
setService ($name, $service) | |||||||||||||
Map a service. | |||||||||||||
setShared ($name, $flag) | |||||||||||||
Add a service sharing rule. | |||||||||||||
Protected Attributes | |
$aliases | |
$factories | |
Protected Attributes inherited from AbstractPluginManager | |
$autoAddInvokableClass = true | |
$instanceOf = null | |
Protected Attributes inherited from ServiceManager | |
$abstractFactories = [] | |
$aliases = [] | |
$allowOverride = false | |
Whether or not changes may be made to this instance. | |
$creationContext | |
$delegators = [] | |
$factories = [] | |
$initializers = [] | |
$lazyServices = [] | |
$services = [] | |
$shared = [] | |
$sharedByDefault = true | |
$configured = false | |
Plugin manager implementation for translation loaders.
Enforces that loaders retrieved are either instances of Loader or Loader. Additionally, it registers a number of default loaders.
If you are wanting to use the ability to load translation files from the include_path, you will need to create a factory to override the defaults defined in this class. A simple factory might look like:
function ($translators) { $adapter = new Gettext(); $adapter->setUseIncludePath(true); return $adapter; }
You may need to override the Translator service factory to make this happen more easily. That can be done by extending it:
use Zend; // or Zend use Zend;
class MyTranslatorServiceFactory extends TranslatorServiceFactory { public function createService(ServiceLocatorInterface $services) { $translator = parent::createService($services); $translator->getLoaderPluginManager()->setFactory(...); return $translator; } }
You would then specify your custom factory in your service configuration.
validate | ( | $plugin | ) |
Validate the plugin.
Checks that the filter loaded is an instance of Loader or Loader.
mixed | $plugin |
Exception\RuntimeException | if invalid |
Implements PluginManagerInterface.
validatePlugin | ( | $plugin | ) |
Validate the plugin is of the expected type (v2).
Proxies to `validate()`.
mixed | $plugin |
Exception\RuntimeException |
|
protected |
|
protected |