Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Element.php
1
<?php
9
namespace
Bitrix\Iblock\Controller
;
10
11
use
Bitrix\Iblock\IblockTable
;
12
use
Bitrix\Main\Application
;
13
use
Bitrix\Main\DI\ServiceLocator
;
14
use
Bitrix\Main\Engine\Contract\FallbackActionInterface
;
15
use
Bitrix\Main\Engine\Controller
;
16
24
final
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
$serviceLocator = ServiceLocator::getInstance();
60
$serviceId =
"iblock.element.{$iblock->getApiCode()}.rest.controller"
;
61
62
if
($serviceLocator->has($serviceId))
63
{
64
// get from service locator
65
$controller = $serviceLocator->get($serviceId);
66
}
67
else
68
{
69
$controller = DefaultElement::class;
70
}
71
72
return
$controller;
73
}
74
75
protected
function
getIblock
()
76
{
77
if
($this->iblock ===
null
)
78
{
79
$iblockId =
Application::getInstance
()->getContext()->getRequest()->get(
'iblockId'
);
80
81
$this->iblock =
IblockTable::getByPrimary
($iblockId, [
82
'select'
=> [
'ID'
,
'API_CODE'
]
83
])->fetchObject();
84
}
85
86
return
$this->iblock
;
87
}
88
}
Bitrix\Iblock\Controller\Element
Definition
Element.php:25
Bitrix\Iblock\Controller\Element\getIblock
getIblock()
Definition
Element.php:75
Bitrix\Iblock\Controller\Element\$iblock
$iblock
Definition
Element.php:26
Bitrix\Iblock\Controller\Element\getDefaultPreFilters
getDefaultPreFilters()
Definition
Element.php:28
Bitrix\Iblock\Controller\Element\fallbackAction
fallbackAction($actionName)
Definition
Element.php:42
Bitrix\Iblock\Controller\Element\getController
getController()
Definition
Element.php:55
Bitrix\Iblock\IblockTable
Definition
iblocktable.php:79
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\DI\ServiceLocator
Definition
servicelocator.php:12
Bitrix\Main\Engine\Controller
Definition
controller.php:32
Bitrix\Main\Engine\Controller\setSourceParametersList
setSourceParametersList($sourceParametersList)
Definition
controller.php:389
Bitrix\Main\Engine\Controller\getSourceParametersList
getSourceParametersList()
Definition
controller.php:379
Bitrix\Main\Engine\Controller\forward
forward($controller, string $actionName, array $parameters=null)
Definition
controller.php:103
Bitrix\Main\ORM\Data\DataManager\getByPrimary
static getByPrimary($primary, array $parameters=array())
Definition
datamanager.php:343
Bitrix\Main\Engine\Contract\FallbackActionInterface
Definition
fallbackactioninterface.php:8
Bitrix\Iblock\Controller
Definition
DefaultElement.php:9
Bitrix\Sender\Internals\QueryController
Definition
action.php:8
modules
iblock
lib
Controller
Element.php
Создано системой
1.10.0