PrintableFormatPluginManager.php in Printer and PDF versions for Drupal 8+ 8
File
src/PrintableFormatPluginManager.php
View source
<?php
namespace Drupal\printable;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class PrintableFormatPluginManager extends DefaultPluginManager {
protected $config;
public function __construct(\Traversable $namespaces, ConfigFactory $config, ModuleHandlerInterface $module_handler) {
$this->config = $config;
parent::__construct('Plugin/PrintableFormat', $namespaces, $module_handler, 'Drupal\\printable\\Plugin\\PrintableFormatInterface', 'Drupal\\printable\\Annotation\\PrintableFormat');
}
public function createInstance($plugin_id, array $configuration = []) {
$configuration += (array) $this->config
->get('printable.format')
->get($plugin_id);
return parent::createInstance($plugin_id, $configuration);
}
}