mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-10-12 02:01:37 +00:00
34 lines
980 B
PHP
34 lines
980 B
PHP
<?php
|
|
|
|
namespace BookStack\View\ViewBlocks;
|
|
|
|
use BookStack\Activity\Tools\UserEntityWatchOptions;
|
|
use BookStack\Entities\Models\Book;
|
|
use BookStack\References\ReferenceFetcher;
|
|
use BookStack\View\SimpleViewBlock;
|
|
|
|
class BooksShowDetails extends SimpleViewBlock
|
|
{
|
|
protected static string $id = 'builtin_books-show-details';
|
|
protected static string $view = 'books.parts.show-sidebar-section-details';
|
|
protected static string $labelTranslationKey = 'common.details';
|
|
|
|
public function __construct(
|
|
protected ReferenceFetcher $referenceFetcher,
|
|
) {
|
|
}
|
|
|
|
public function getViewData(array $viewData): array
|
|
{
|
|
/** @var Book $book */
|
|
$book = $viewData['book'];
|
|
$referenceCount = $this->referenceFetcher->getReferenceCountToEntity($book);
|
|
|
|
return [
|
|
'book' => $book,
|
|
'watchOptions' => new UserEntityWatchOptions(user(), $book),
|
|
'referenceCount' => $referenceCount,
|
|
];
|
|
}
|
|
}
|