You are here

public function BookManager::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/book/src/BookManager.php \Drupal\book\BookManager::__construct()

Constructs a BookManager object.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\StringTranslation\TranslationInterface $translation: The string translation service.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\book\BookOutlineStorageInterface $book_outline_storage: The book outline storage.

\Drupal\Core\Render\RendererInterface $renderer: The renderer.

\Drupal\Core\Language\LanguageManagerInterface|null $language_manager: The language manager.

\Drupal\Core\Entity\EntityRepositoryInterface|null $entity_repository: The entity repository service.

\Drupal\Core\Cache\CacheBackendInterface $backend_chained_cache: The book chained backend cache service.

\Drupal\Core\Cache\CacheBackendInterface $memory_cache: The book memory cache service.

File

core/modules/book/src/BookManager.php, line 125

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $translation, ConfigFactoryInterface $config_factory, BookOutlineStorageInterface $book_outline_storage, RendererInterface $renderer, LanguageManagerInterface $language_manager = NULL, EntityRepositoryInterface $entity_repository = NULL, CacheBackendInterface $backend_chained_cache = NULL, CacheBackendInterface $memory_cache = NULL) {
  $this->entityTypeManager = $entity_type_manager;
  $this->stringTranslation = $translation;
  $this->configFactory = $config_factory;
  $this->bookOutlineStorage = $book_outline_storage;
  $this->renderer = $renderer;
  if (!$language_manager) {
    @trigger_error('The language_manager service must be passed to ' . __NAMESPACE__ . '\\BookManager::__construct(). It was added in drupal:9.2.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
    $language_manager = \Drupal::service('language_manager');
  }
  $this->languageManager = $language_manager;
  if (!$entity_repository) {
    @trigger_error('The entity.repository service must be passed to ' . __NAMESPACE__ . '\\BookManager::__construct(). It was added in drupal:9.2.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
    $entity_repository = \Drupal::service('entity.repository');
  }
  $this->entityRepository = $entity_repository;
  if (!$backend_chained_cache) {
    @trigger_error('Calling BookManager::__construct() without the $backend_chained_cache argument is deprecated in drupal:9.3.0 and the $backend_chained_cache argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3039439', E_USER_DEPRECATED);
    $backend_chained_cache = \Drupal::service('book.backend_chained_cache');
  }
  $this->backendChainedCache = $backend_chained_cache;
  if (!$memory_cache) {
    @trigger_error('Calling BookManager::__construct() without the $memory_cache argument is deprecated in drupal:9.3.0 and the $memory_cache argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3039439', E_USER_DEPRECATED);
    $memory_cache = \Drupal::service('book.memory_cache');
  }
  $this->memoryCache = $memory_cache;
}