Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
HasSettingsTrait.php
1<?php
2
3namespace Bitrix\Catalog\v2;
4
6
7trait HasSettingsTrait
8{
9 protected $settings;
10
11 private function getStorage(): FieldStorage
12 {
13 if ($this->settings === null)
14 {
15 $this->settings = new FieldStorage();
16 }
17
18 return $this->settings;
19 }
20
25 public function setSettings(array $settings): self
26 {
27 $this->getStorage()->initFields($settings);
28
29 return $this;
30 }
31
32 public function getSettings(): array
33 {
34 return $this->getStorage()->toArray();
35 }
36
37 public function getSetting(string $name)
38 {
39 return $this->getStorage()->getField($name);
40 }
41}
getSetting(string $name)
setSettings(array $settings)