Files
BookStack/app/View/ViewBlocks/BooksShowDetails.php
T
Dan Brown 97fe7cca9d View Blocks: Added base implementation class
Also removed unused imports from app/ classes.
2026-09-21 13:03:18 +01:00

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,
];
}
}