Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
standartbuilder.php
1
<?php
2
3
namespace
Bitrix\Landing\Assets
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
7
class
StandartBuilder
extends
Builder
8
{
12
public
function
setOutput
(): void
13
{
14
if
($this->resources->isEmpty())
15
{
16
return
;
17
}
18
19
$this->
normalizeResources
();
20
$this->
initResourcesAsJsExtension
($this->normalizedResources);
21
22
$this->
setStrings
();
23
}
24
25
protected
function
normalizeResources
(): void
26
{
27
$this->normalizedResources = $this->resources->getNormalized();
28
$this->
normalizeLangResources
();
29
}
30
31
protected
function
normalizeLangResources
(): void
32
{
33
$langResources = $this->normalizedResources[
Types::TYPE_LANG
] ??
null
;
34
if
(isset($langResources) && !empty($langResources))
35
{
36
// convert array to string (get first element)
37
$this->normalizedResources[
Types::TYPE_LANG
] = $this->normalizedResources[
Types::TYPE_LANG
][0];
38
39
// other files load by additional lang
40
if
($additionalLang = self::loadAdditionalLangPhrases(array_slice($langResources, 1)))
41
{
42
$this->normalizedResources[
Types::TYPE_LANG_ADDITIONAL
] = $additionalLang;
43
}
44
}
45
}
46
47
protected
static
function
loadAdditionalLangPhrases
(array $langResources): array
48
{
49
$additionalLangPhrases = [];
50
foreach
($langResources as $file)
51
{
52
foreach
(
Loc::loadLanguageFile
($_SERVER[
'DOCUMENT_ROOT'
] . $file) as $key => $phrase)
53
{
54
$additionalLangPhrases[$key] = $phrase;
55
}
56
}
57
58
return
$additionalLangPhrases;
59
}
60
}
Bitrix\Landing\Assets\Builder
Definition
builder.php:11
Bitrix\Landing\Assets\Builder\setStrings
setStrings()
Definition
builder.php:108
Bitrix\Landing\Assets\Builder\initResourcesAsJsExtension
initResourcesAsJsExtension(array $resources, $extName=null)
Definition
builder.php:87
Bitrix\Landing\Assets\StandartBuilder
Definition
standartbuilder.php:8
Bitrix\Landing\Assets\StandartBuilder\loadAdditionalLangPhrases
static loadAdditionalLangPhrases(array $langResources)
Definition
standartbuilder.php:47
Bitrix\Landing\Assets\StandartBuilder\normalizeResources
normalizeResources()
Definition
standartbuilder.php:25
Bitrix\Landing\Assets\StandartBuilder\normalizeLangResources
normalizeLangResources()
Definition
standartbuilder.php:31
Bitrix\Landing\Assets\StandartBuilder\setOutput
setOutput()
Definition
standartbuilder.php:12
Bitrix\Landing\Assets\Types\TYPE_LANG_ADDITIONAL
const TYPE_LANG_ADDITIONAL
Definition
types.php:11
Bitrix\Landing\Assets\Types\TYPE_LANG
const TYPE_LANG
Definition
types.php:10
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadLanguageFile
static loadLanguageFile($file, $language=null, $normalize=true)
Definition
loc.php:224
Bitrix\Landing\Assets
Definition
builder.php:3
modules
landing
lib
assets
standartbuilder.php
Создано системой
1.10.0