OpenApiGeneratorManager.php in OpenAPI 8
File
src/Plugin/openapi/OpenApiGeneratorManager.php
View source
<?php
namespace Drupal\openapi\Plugin\openapi;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class OpenApiGeneratorManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/openapi/OpenApiGenerator', $namespaces, $module_handler, 'Drupal\\openapi\\Plugin\\openapi\\OpenApiGeneratorInterface', 'Drupal\\openapi\\Annotation\\OpenApiGenerator');
$this
->alterInfo('openapi_generator');
$this
->setCacheBackend($cache_backend, 'openapi_generator_plugins');
}
protected function findDefinitions() {
$definitions = parent::findDefinitions();
foreach ([
'jsonapi',
'rest',
] as $api_module) {
if (isset($definitions[$api_module]) && !$this->moduleHandler
->moduleExists($api_module)) {
unset($definitions[$api_module]);
}
}
return $definitions;
}
}