Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Component
ComponentRegistrar.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Component
;
7
16
class
ComponentRegistrar
implements
ComponentRegistrarInterface
17
{
21
const
MODULE
=
'module'
;
22
const
LIBRARY
=
'library'
;
23
const
THEME
=
'theme'
;
24
const
LANGUAGE
=
'language'
;
25
const
SETUP
=
'setup'
;
29
private
static
$paths = [
30
self::MODULE => [],
31
self::LIBRARY => [],
32
self::LANGUAGE => [],
33
self::THEME => [],
34
self::SETUP => []
35
];
36
46
public
static
function
register
(
$type
, $componentName,
$path
)
47
{
48
self::validateType(
$type
);
49
if
(isset(
self::$paths
[
$type
][$componentName])) {
50
throw
new \LogicException(
51
ucfirst(
$type
) .
' \''
. $componentName .
'\'
from \
''
.
$path
.
'\'
'
52
. '
has been already defined in \
''
.
self::$paths
[
$type
][$componentName] .
'\'
.
'
53
);
54
} else {
55
self::$paths[$type][$componentName] = str_replace('
\\
', '
/
', $path);
56
}
57
}
58
62
public function getPaths($type)
63
{
64
self::validateType($type);
65
return self::$paths[$type];
66
}
67
71
public function getPath($type, $componentName)
72
{
73
self::validateType($type);
74
return self::$paths[$type][$componentName] ?? null;
75
}
76
84
private static function validateType($type)
85
{
86
if (!isset(self::$paths[$type])) {
87
throw new \LogicException('
\
''
.
$type
.
'\'
is not a valid component type
');
88
}
89
}
90
}
Magento\Framework\Component\ComponentRegistrar\THEME
const THEME
Definition:
ComponentRegistrar.php:23
Magento\Framework\Component
Definition:
ComponentFile.php:6
$type
$type
Definition:
item.phtml:13
Magento\Framework\Component\ComponentRegistrar\MODULE
const MODULE
Definition:
ComponentRegistrar.php:21
Magento\Framework\Component\ComponentRegistrar\SETUP
const SETUP
Definition:
ComponentRegistrar.php:25
Magento\Framework\Component\ComponentRegistrar\LIBRARY
const LIBRARY
Definition:
ComponentRegistrar.php:22
Magento\Framework\Component\ComponentRegistrarInterface
Definition:
ComponentRegistrarInterface.php:11
Magento\Framework\Component\ComponentRegistrar
Definition:
ComponentRegistrar.php:16
$paths
$paths
Definition:
_bootstrap.php:83
$path
$path
Definition:
import_with_filesystem_images.php:14
Magento\Framework\Component\ComponentRegistrar\LANGUAGE
const LANGUAGE
Definition:
ComponentRegistrar.php:24