function BookExport::__construct

Same name in other branches
  1. 8.9.x core/modules/book/src/BookExport.php \Drupal\book\BookExport::__construct()
  2. 10 core/modules/book/src/BookExport.php \Drupal\book\BookExport::__construct()
  3. 11.x core/modules/book/src/BookExport.php \Drupal\book\BookExport::__construct()

Constructs a BookExport object.

Parameters

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

\Drupal\book\BookManagerInterface $book_manager: The book manager.

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

File

core/modules/book/src/BookExport.php, line 54

Class

BookExport
Provides methods for exporting book to different formats.

Namespace

Drupal\book

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, BookManagerInterface $book_manager, EntityRepositoryInterface $entity_repository = NULL) {
    $this->nodeStorage = $entity_type_manager->getStorage('node');
    $this->viewBuilder = $entity_type_manager->getViewBuilder('node');
    $this->bookManager = $book_manager;
    if (!$entity_repository) {
        @trigger_error('The entity.repository service must be passed to ' . __NAMESPACE__ . '\\BookExport::__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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.