Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/Controller/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage iblock * @copyright 2001-2020 Bitrix */ namespace Bitrix\Iblock\Controller; use Bitrix\Iblock\IblockTable; use Bitrix\Main\Application; use Bitrix\Main\DI\ServiceLocator; use Bitrix\Main\Engine\Contract\FallbackActionInterface; use Bitrix\Main\Engine\Controller; /** * This is a facade class * @see DefaultElement * * @package bitrix * @subpackage main */ final class Element extends Controller implements FallbackActionInterface { protected $iblock; protected function getDefaultPreFilters() { return []; } /** * Proxying all actions to the real controller * * @param string $actionName * * @return \Bitrix\Main\HttpResponse|mixed|null * @throws \Bitrix\Main\ObjectNotFoundException * @throws \Bitrix\Main\SystemException */ public function fallbackAction($actionName) { $this->setSourceParametersList(array_merge( $this->getSourceParametersList(), [['iblock' => $this->getIblock()]] )); return $this->forward($this->getController(), $actionName); } /** * @return Controller * @throws \Bitrix\Main\ObjectNotFoundException */ protected function getController() { $iblock = $this->getIblock(); $controller = DefaultElement::class; if ($iblock) { $serviceLocator = ServiceLocator::getInstance(); $serviceId = "iblock.element.{$iblock->getApiCode()}.rest.controller"; if ($serviceLocator->has($serviceId)) { // get from service locator $controller = $serviceLocator->get($serviceId); } } return $controller; } protected function getIblock() { if ($this->iblock === null) { $iblockId = Application::getInstance()->getContext()->getRequest()->get('iblockId'); $this->iblock = IblockTable::getByPrimary($iblockId, [ 'select' => ['ID', 'API_CODE'] ])->fetchObject(); } return $this->iblock; } }