Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
PropertyFeatureEditorFields.php
1<?php
2
4
6
13{
14 private array $property;
15 private array $fields;
16
20 public function __construct(array $propertyFields)
21 {
22 $this->property = $propertyFields;
23 }
24
30 public function getEntityFields(): array
31 {
32 if (isset($this->fields))
33 {
34 return $this->fields;
35 }
36
37 if (!PropertyFeature::isEnabledFeatures())
38 {
39 return [];
40 }
41
42 $this->fields = [];
43
44 $features = PropertyFeature::getPropertyFeatureList($this->property);
45 foreach ($features as $feature)
46 {
47 $index = PropertyFeature::getIndex($feature);
48
49 $this->fields[] = [
50 'name' => "FEATURES[{$index}]",
51 'title' => $feature['FEATURE_NAME'],
52 'type' => 'boolean',
53 ];
54 }
55
56 return $this->fields;
57 }
58
64 public function isHasFields(): bool
65 {
66 return !empty($this->getEntityFields());
67 }
68}