IntervalPluginManager.php in Interval Field 8
File
src/IntervalPluginManager.php
View source
<?php
namespace Drupal\interval;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
use Drupal\Core\Plugin\Factory\ContainerFactory;
class IntervalPluginManager extends DefaultPluginManager implements IntervalPluginManagerInterface {
protected $defaults = [
'plural' => '',
'singular' => '',
'php' => 'hours',
'multiplier' => 1,
'class' => 'Drupal\\interval\\IntervalBase',
'id' => '',
];
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$this->discovery = new YamlDiscovery('intervals', $module_handler
->getModuleDirectories());
$this->discovery
->addTranslatableProperty('plural', 'plural_context');
$this->discovery
->addTranslatableProperty('singular', 'singular_context');
$this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new ContainerFactory($this);
$this->moduleHandler = $module_handler;
$this
->alterInfo('intervals');
$this
->setCacheBackend($cache_backend, 'interval_plugins');
}
}