1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Element.php
См. документацию.
1<?php
8
9namespace Bitrix\Iblock\Controller;
10
11use Bitrix\Iblock\IblockTable;
12use Bitrix\Main\Application;
13use Bitrix\Main\DI\ServiceLocator;
14use Bitrix\Main\Engine\Contract\FallbackActionInterface;
15use Bitrix\Main\Engine\Controller;
16
24final class Element extends Controller implements FallbackActionInterface
25{
26 protected $iblock;
27
28 protected function getDefaultPreFilters()
29 {
30 return [];
31 }
32
42 public function fallbackAction($actionName)
43 {
44 $this->setSourceParametersList(array_merge(
45 $this->getSourceParametersList(), [['iblock' => $this->getIblock()]]
46 ));
47
48 return $this->forward($this->getController(), $actionName);
49 }
50
55 protected function getController()
56 {
57 $iblock = $this->getIblock();
58
59 $controller = DefaultElement::class;
60
61 if ($iblock)
62 {
63 $serviceLocator = ServiceLocator::getInstance();
64 $serviceId = "iblock.element.{$iblock->getApiCode()}.rest.controller";
65
66 if ($serviceLocator->has($serviceId))
67 {
68 // get from service locator
69 $controller = $serviceLocator->get($serviceId);
70 }
71 }
72
73 return $controller;
74 }
75
76 protected function getIblock()
77 {
78 if ($this->iblock === null)
79 {
80 $iblockId = Application::getInstance()->getContext()->getRequest()->get('iblockId');
81
82 $this->iblock = IblockTable::getByPrimary($iblockId, [
83 'select' => ['ID', 'API_CODE']
84 ])->fetchObject();
85 }
86
87 return $this->iblock;
88 }
89}
getDefaultPreFilters()
Определения Element.php:28
fallbackAction($actionName)
Определения Element.php:42
static getByPrimary($primary, array $parameters=array())
Определения datamanager.php:330
$iblockId
Определения iblock_catalog_edit.php:30