Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс
This commit is contained in:
commit
f6ba0d2174
470 files changed
+26454
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jinove\Vinoteca\Controller;
|
||||
|
||||
use Bitrix\Main\Engine\ActionFilter\HttpMethod;
|
||||
use Bitrix\Main\Engine\Controller;
|
||||
use Bitrix\Main\Engine\Response\Component;
|
||||
use Bitrix\Main\Error;
|
||||
use Jinove\Vinoteca\News as NewsList;
|
||||
|
||||
class News extends Controller
|
||||
{
|
||||
public function configureActions(): array
|
||||
{
|
||||
return [
|
||||
"page" => [
|
||||
"prefilters" => [new HttpMethod([HttpMethod::METHOD_GET])],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function pageAction(): ?Component
|
||||
{
|
||||
$page = (string)$this->getRequest()->getQuery("PAGEN_1");
|
||||
if (!ctype_digit($page) || (int)$page < 1 || (int)$page > NewsList::pageCount()) {
|
||||
$this->addError(new Error("Wrong page"));
|
||||
|
||||
return null;
|
||||
}
|
||||
$meta = NewsList::pageMeta((int)$page);
|
||||
|
||||
return new Component(
|
||||
"bitrix:news.list",
|
||||
NewsList::LIST_TEMPLATE,
|
||||
NewsList::listParams(true),
|
||||
[],
|
||||
static fn(): array => ["title" => $meta["title"]]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user