ContainerFactory example


    return $this->discovery;
  }

  /** * Gets the plugin factory. * * @return \Drupal\Component\Plugin\Factory\FactoryInterface */
  protected function getFactory() {
    if (!isset($this->factory)) {
      $this->factory = new ContainerFactory($this);
    }
    return $this->factory;
  }

  /** * {@inheritdoc} */
  public function getDefinitions() {
    // Since this function is called rarely, instantiate the discovery here.     $definitions = $this->getDiscovery()->getDefinitions();

    
$discovery = new AnnotatedClassDiscovery($this->subdir, $this->namespaces, $this->pluginDefinitionAnnotationName, $this->additionalAnnotationNamespaces);
      $this->discovery = new ContainerDerivativeDiscoveryDecorator($discovery);
    }
    return $this->discovery;
  }

  /** * {@inheritdoc} */
  protected function getFactory() {
    if (!$this->factory) {
      $this->factory = new ContainerFactory($this$this->pluginInterface);
    }
    return $this->factory;
  }

  /** * Finds plugin definitions. * * @return array * List of definitions to store in cache. */
  protected function findDefinitions() {
    
protected ComponentNegotiator $componentNegotiator,
    protected FileSystemInterface $fileSystem,
    protected SchemaCompatibilityChecker $compatibilityChecker,
    protected ComponentValidator $componentValidator,
    protected string $appRoot,
  ) {
    // We are skipping the call to the parent constructor to avoid initializing     // variables aimed for annotation discovery, that are unnecessary here.     // Plugin managers using YAML discovery also skip the parent constructor,     // like LinkRelationTypeManager.     $this->moduleHandler = $module_handler;
    $this->factory = new ContainerFactory($this);
    $this->setCacheBackend($cacheBackend, 'sdc_plugins');
    // Note that we are intentionally skipping $this->alterInfo('sdc_info');     // We want to ensure that everything related to a component is in the     // single directory. If the alteration of a component is necessary,     // component replacement is the preferred tool for that.   }

  /** * Creates an instance. * * @throws \Drupal\sdc\Exception\ComponentNotFoundException * * @internal */
/** * Construct a migration plugin manager. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * The cache backend for the definitions. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */
  public function __construct(ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager) {
    $this->factory = new ContainerFactory($this$this->pluginInterface);
    $this->alterInfo('migration_plugins');
    $this->setCacheBackend($cache_backend, 'migration_plugins', ['migration_plugins']);
    $this->moduleHandler = $module_handler;
  }

  /** * Gets the plugin discovery. * * This method overrides DefaultPluginManager::getDiscovery() in order to * search for migration configurations in the MODULENAME/migrations * directory. */

  public function __construct(CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, TypedConfigManagerInterface $typed_config_manager, ThemeHandlerInterface $theme_handler) {
    $this->typedConfigManager = $typed_config_manager;

    $this->factory = new ContainerFactory($this, '\Drupal\config_translation\ConfigMapperInterface');

    // Let others alter definitions with hook_config_translation_info_alter().     $this->moduleHandler = $module_handler;
    $this->themeHandler = $theme_handler;

    $this->alterInfo('config_translation_info');
    // Config translation only uses an info hook discovery, cache by language.     $cache_key = 'config_translation_info_plugins' . ':' . $language_manager->getCurrentLanguage()->getId();
    $this->setCacheBackend($cache_backend$cache_key['config_translation_info_plugins']);
  }

  

  public function __construct(ControllerResolverInterface $controller_resolver, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account, RequestStack $request_stack) {
    $this->factory = new ContainerFactory($this, '\Drupal\Core\Menu\ContextualLinkInterface');
    $this->controllerResolver = $controller_resolver;
    $this->accessManager = $access_manager;
    $this->account = $account;
    $this->moduleHandler = $module_handler;
    $this->requestStack = $request_stack;
    $this->alterInfo('contextual_links_plugins');
    $this->setCacheBackend($cache_backend, 'contextual_links_plugins:' . $language_manager->getCurrentLanguage()->getId()['contextual_links_plugins']);
  }

  /** * {@inheritdoc} */

  public function __construct(ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, CacheBackendInterface $cache_backend, TranslationInterface $string_translation) {
    $this->factory = new ContainerFactory($this);
    $this->moduleHandler = $module_handler;
    $this->themeHandler = $theme_handler;
    $this->setStringTranslation($string_translation);
    $this->alterInfo('breakpoints');
    $this->setCacheBackend($cache_backend, 'breakpoints', ['breakpoints']);
  }

  /** * {@inheritdoc} */
  protected function getDiscovery() {
    

  public function __construct(ArgumentResolverInterface $argument_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
    // Skip calling the parent constructor, since that assumes annotation-based     // discovery.     $this->factory = new ContainerFactory($this, 'Drupal\Core\Menu\LocalActionInterface');
    $this->argumentResolver = $argument_resolver;
    $this->requestStack = $request_stack;
    $this->routeMatch = $route_match;
    $this->routeProvider = $route_provider;
    $this->accessManager = $access_manager;
    $this->moduleHandler = $module_handler;
    $this->account = $account;
    $this->alterInfo('menu_local_actions');
    $this->setCacheBackend($cache_backend, 'local_action_plugins:' . $language_manager->getCurrentLanguage()->getId()['local_action']);
  }

  

  public function __construct(ArgumentResolverInterface $argument_resolver, RequestStack $request_stack, RouteMatchInterface $route_match, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
    $this->factory = new ContainerFactory($this, '\Drupal\Core\Menu\LocalTaskInterface');
    $this->argumentResolver = $argument_resolver;
    $this->requestStack = $request_stack;
    $this->routeMatch = $route_match;
    $this->routeProvider = $route_provider;
    $this->accessManager = $access_manager;
    $this->account = $account;
    $this->moduleHandler = $module_handler;
    $this->alterInfo('local_tasks');
    $this->setCacheBackend($cache, 'local_task_plugins:' . $language_manager->getCurrentLanguage()->getId()['local_task']);
  }

  
Home | Imprint | This part of the site doesn't use cookies.