mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-10-12 02:01:37 +00:00
So that their metadata can be read without having to create instances and fullfill dependancy injection just to list. Also added title to interface prefs page.
27 lines
675 B
PHP
27 lines
675 B
PHP
<?php
|
|
|
|
namespace BookStack\View\ViewBlocks;
|
|
|
|
use BookStack\Entities\Queries\BookQueries;
|
|
use BookStack\View\ViewBlock;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BooksIndexPopular extends ViewBlock
|
|
{
|
|
protected static string $id = 'builtin_books-index-popular';
|
|
protected static string $view = 'books.parts.index-sidebar-section-popular';
|
|
protected static string $labelTranslationKey = 'entities.books_popular';
|
|
|
|
public function __construct(
|
|
protected BookQueries $queries,
|
|
) {
|
|
}
|
|
|
|
public function withData(array $viewData): array
|
|
{
|
|
return [
|
|
'popular' => $this->queries->popularForList()->take(4)->get(),
|
|
];
|
|
}
|
|
}
|