Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
source.php
1<?php
2
4
10
16abstract class Source
17{
19 protected $code;
20
22 protected $name;
23
25 protected $isDefault = false;
26
28 protected $config;
29
31 protected $autocompleteReplacements = null;
32
36 public function getCode(): string
37 {
38 return $this->code;
39 }
40
45 public function setCode(string $code): Source
46 {
47 $this->code = $code;
48
49 return $this;
50 }
51
55 public function getName(): ?string
56 {
57 return $this->name;
58 }
59
64 public function setName(string $name): Source
65 {
66 $this->name = $name;
67
68 return $this;
69 }
70
74 public function isDefault(): bool
75 {
76 return $this->isDefault;
77 }
78
79 public function isAvailable(): bool
80 {
81 return true;
82 }
83
87 public function getConfig(): ?Config
88 {
89 return $this->config;
90 }
91
96 public function setConfig(?Config $config): Source
97 {
98 $this->config = $config;
99
100 return $this;
101 }
102
109 public function getAutocompleteReplacements(string $languageId): array
110 {
111 if($this->autocompleteReplacements === null)
112 {
113 $this->autocompleteReplacements = [];
114
115 $path = Context::getCurrent()->getServer()->getDocumentRoot()
116 . '/bitrix/modules/location/lang/'
117 . $languageId
118 . '/lib/source/'
119 . strtolower($this->code)
120 . '/autocompletereplacements.php';
121
122 if (File::isFileExists($path))
123 {
124 $this->autocompleteReplacements = StreamConverter::include($path, $languageId);
125 }
126 }
127
128 return $this->autocompleteReplacements;
129 }
130
136 abstract public function makeRepository(): IRepository;
137
143 abstract public function getJSParams(): array;
144
149 abstract public function convertLang(string $bitrixLang): string;
150}
setConfig(?Config $config)
Definition source.php:96
getAutocompleteReplacements(string $languageId)
Definition source.php:109
convertLang(string $bitrixLang)
static getCurrent()
Definition context.php:241