setCacheBackend example


  public function __construct(StorageInterface $configStorage, StorageInterface $schemaStorage, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler, ClassResolverInterface $class_resolver = NULL) {
    $this->configStorage = $configStorage;
    $this->schemaStorage = $schemaStorage;
    $this->setCacheBackend($cache, 'typed_config_definitions');
    $this->alterInfo('config_schema_info');
    $this->moduleHandler = $module_handler;
    $this->classResolver = $class_resolver ?: \Drupal::service('class_resolver');
  }

  /** * {@inheritdoc} */
  protected function getDiscovery() {
    if (!isset($this->discovery)) {
      $this->discovery = new ConfigSchemaDiscovery($this->schemaStorage);
    }

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    $this->factory = new ConstraintFactory($this);
    parent::__construct('Plugin/Validation/Constraint', $namespaces$module_handler, NULL, 'Drupal\Core\Validation\Annotation\Constraint');
    $this->alterInfo('validation_constraint');
    $this->setCacheBackend($cache_backend, 'validation_constraint_plugins');
  }

  /** * {@inheritdoc} */
  protected function getDiscovery() {
    if (!isset($this->discovery)) {
      $this->discovery = parent::getDiscovery();
      $this->discovery = new StaticDiscoveryDecorator($this->discovery, [$this, 'registerDefinitions']);
    }
    return $this->discovery;
  }

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/CKEditor4To5Upgrade', $namespaces$module_handler, CKEditor4To5UpgradePluginInterface::class, CKEditor4To5Upgrade::class);

    $this->alterInfo('ckeditor4to5upgrade_plugin_info');
    $this->setCacheBackend($cache_backend, 'ckeditor4to5upgrade_plugins');
  }

  /** * Validates plugin definitions: avoids conflicts. Builds maps for later use. */
  protected function validateAndBuildMaps(): void {
    if ($this->cke4ButtonsMap !== NULL) {
      return;
    }

    foreach ($this->getDefinitions() as $upgrade_plugin_id => $definition) {
      

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager) {
    parent::__construct('Plugin/Field/FieldWidget', $namespaces$module_handler, 'Drupal\Core\Field\WidgetInterface', 'Drupal\Core\Field\Annotation\FieldWidget');

    $this->setCacheBackend($cache_backend, 'field_widget_types_plugins');
    $this->alterInfo('field_widget_info');
    $this->fieldTypeManager = $field_type_manager;
  }

  /** * Overrides PluginManagerBase::getInstance(). * * @param array $options * An array with the following key/value pairs: * - field_definition: (FieldDefinitionInterface) The field definition. * - form_mode: (string) The form mode. * - prepare: (bool, optional) Whether default values should get merged in * the 'configuration' array. Defaults to TRUE. * - configuration: (array) the configuration for the widget. The * following key value pairs are allowed, and are all optional if * 'prepare' is TRUE: * - type: (string) The widget to use. Defaults to the * 'default_widget' for the field type. The default widget will also be * used if the requested widget is not available. * - settings: (array) Settings specific to the widget. Each setting * defaults to the default value specified in the widget definition. * - third_party_settings: (array) Settings provided by other extensions * through hook_field_formatter_third_party_settings_form(). * * @return \Drupal\Core\Field\WidgetInterface|false * A Widget object or FALSE when plugin is not found. */

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) {
    parent::__construct('Plugin/Layout', $namespaces$module_handler, LayoutInterface::class, Layout::class);
    $this->themeHandler = $theme_handler;

    $type = $this->getType();
    $this->setCacheBackend($cache_backend$type);
    $this->alterInfo($type);
  }

  /** * {@inheritdoc} */
  protected function getType() {
    return 'layout';
  }

  /** * {@inheritdoc} */

  public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, TranslationInterface $string_translation, ClassResolverInterface $class_resolver, EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository) {
    parent::__construct('Entity', $namespaces$module_handler, 'Drupal\Core\Entity\EntityInterface');

    $this->setCacheBackend($cache, 'entity_type', ['entity_types']);
    $this->alterInfo('entity_type');

    $this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, 'Drupal\Core\Entity\Annotation\EntityType');
    $this->stringTranslation = $string_translation;
    $this->classResolver = $class_resolver;
    $this->entityLastInstalledSchemaRepository = $entity_last_installed_schema_repository;
  }

  /** * {@inheritdoc} */
  

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, CacheTagsInvalidatorInterface $cache_tag_invalidator, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager) {
    $this->setCacheBackend($cache_backend, 'element_info');
    $this->themeManager = $theme_manager;
    $this->cacheTagInvalidator = $cache_tag_invalidator;

    parent::__construct('Element', $namespaces$module_handler, 'Drupal\Core\Render\Element\ElementInterface', 'Drupal\Core\Render\Annotation\RenderElement');
    $this->alterInfo('element_plugin');
  }

  /** * {@inheritdoc} */
  public function getInfo($type) {
    
$this->discovery = $discovery;
    $this->factory = $factory;
    $this->routeProvider = $route_provider;
    $this->accessManager = $access_manager;
    $this->account = $account;
    $this->argumentResolver = $argument_resolver;
    $this->requestStack = new RequestStack();
    $this->requestStack->push($request);
    $this->routeMatch = $route_match;
    $this->moduleHandler = $module_handler;
    $this->alterInfo('menu_local_actions');
    $this->setCacheBackend($cache_backend, 'local_action_plugins', ['local_action']);
  }

}

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ClassResolverInterface $class_resolver) {
    $this->alterInfo('data_type_info');
    $this->setCacheBackend($cache_backend, 'typed_data_types_plugins');
    $this->classResolver = $class_resolver;

    parent::__construct('Plugin/DataType', $namespaces$module_handler, NULL, 'Drupal\Core\TypedData\Annotation\DataType');
  }

  /** * {@inheritdoc} */
  public function createInstance($data_type, array $configuration = []) {
    $data_definition = $configuration['data_definition'];
    $type_definition = $this->getDefinition($data_type);

    

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/DisplayVariant', $namespaces$module_handler, 'Drupal\Core\Display\VariantInterface', 'Drupal\Core\Display\Annotation\DisplayVariant');

    $this->setCacheBackend($cache_backend, 'variant_plugins');
    $this->alterInfo('display_variant_plugin');
  }

}
$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']);
  }

  /** * {@inheritdoc} */
  protected function getDiscovery() {
    if (!isset($this->discovery)) {
      // Look at all themes and modules.       // @todo If the list of installed modules and themes is changed, new       // definitions are not picked up immediately and obsolete definitions       // are not removed, because the list of search directories is only

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    $this->alterInfo('condition_info');
    $this->setCacheBackend($cache_backend, 'condition_plugins');

    parent::__construct('Plugin/Condition', $namespaces$module_handler, 'Drupal\Core\Condition\ConditionInterface', 'Drupal\Core\Condition\Annotation\Condition');
  }

  /** * {@inheritdoc} */
  protected function getType() {
    return 'condition';
  }

  

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ContextHandlerInterface $context_handler) {
    parent::__construct('Plugin/SectionStorage', $namespaces$module_handler, SectionStorageInterface::class, SectionStorage::class);

    $this->contextHandler = $context_handler;

    $this->alterInfo('layout_builder_section_storage');
    $this->setCacheBackend($cache_backend, 'layout_builder_section_storage_plugins');
  }

  /** * {@inheritdoc} */
  protected function findDefinitions() {
    $definitions = parent::findDefinitions();

    // Sort the definitions by their weight while preserving the original order     // for those with matching weights.     $weights = array_map(function DSectionStorageDefinition $definition) {
      

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LoggerInterface $logger) {
    parent::__construct('Plugin/Block', $namespaces$module_handler, 'Drupal\Core\Block\BlockPluginInterface', 'Drupal\Core\Block\Annotation\Block');

    $this->alterInfo($this->getType());
    $this->setCacheBackend($cache_backend, 'block_plugins');
    $this->logger = $logger;
  }

  /** * {@inheritdoc} */
  protected function getType() {
    return 'block';
  }

  /** * {@inheritdoc} */

  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) {
    parent::__construct('Plugin/ImageToolkit', $namespaces$module_handler, 'Drupal\Core\ImageToolkit\ImageToolkitInterface', 'Drupal\Core\ImageToolkit\Annotation\ImageToolkit');

    $this->setCacheBackend($cache_backend, 'image_toolkit_plugins');
    $this->configFactory = $config_factory;
  }

  /** * Gets the default image toolkit ID. * * @return string|bool * ID of the default toolkit, or FALSE on error. */
  public function getDefaultToolkitId() {
    $toolkit_id = $this->configFactory->get('system.image')->get('toolkit');
    
Home | Imprint | This part of the site doesn't use cookies.