Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
CatalogRuleFactory.php
1
<?php
2
3
namespace
Bitrix\Catalog\Access\Rule\Factory
;
4
5
use
Bitrix\Catalog\Access\ActionDictionary
;
6
use
Bitrix\Main\Access\AccessibleController
;
7
use
Bitrix\Main\Access\Rule\Factory\RuleControllerFactory
;
8
9
class
CatalogRuleFactory
extends
RuleControllerFactory
10
{
11
protected
const
BASE_RULE
=
'Base'
;
12
13
protected
function
getClassName
(
string
$action,
AccessibleController
$controller): ?string
14
{
15
$actionName =
ActionDictionary::getActionRuleName
($action);
16
if
(!$actionName)
17
{
18
return
null
;
19
}
20
21
$action = explode(
'_'
, $actionName);
22
$action = array_map(fn($el) => ucfirst(mb_strtolower($el)), $action);
23
24
$ruleClass = $this->
getNamespace
($controller) . implode($action) . static::SUFFIX;
25
26
if
(class_exists($ruleClass))
27
{
28
return
$ruleClass;
29
}
30
31
return
$this->
getNamespace
($controller) . static::BASE_RULE . static::SUFFIX;
32
}
33
}
Bitrix\Catalog\Access\ActionDictionary
Definition
ActionDictionary.php:17
Bitrix\Catalog\Access\ActionDictionary\getActionRuleName
static getActionRuleName(string $value)
Definition
ActionDictionary.php:191
Bitrix\Catalog\Access\Rule\Factory\CatalogRuleFactory
Definition
CatalogRuleFactory.php:10
Bitrix\Catalog\Access\Rule\Factory\CatalogRuleFactory\BASE_RULE
const BASE_RULE
Definition
CatalogRuleFactory.php:11
Bitrix\Catalog\Access\Rule\Factory\CatalogRuleFactory\getClassName
getClassName(string $action, AccessibleController $controller)
Definition
CatalogRuleFactory.php:13
Bitrix\Main\Access\Rule\Factory\RuleControllerFactory
Definition
rulecontrollerfactory.php:11
Bitrix\Main\Access\Rule\Factory\RuleControllerFactory\getNamespace
getNamespace(AccessibleController $controller)
Definition
rulecontrollerfactory.php:39
Bitrix\Main\Access\AccessibleController
Definition
accessiblecontroller.php:15
Bitrix\Catalog\Access\Rule\Factory
Definition
CatalogRuleFactory.php:3
modules
catalog
lib
Access
Rule
Factory
CatalogRuleFactory.php
Создано системой
1.10.0