1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Link.php
См. документацию.
1<?php
2declare(strict_types=1);
3
4namespace Bitrix\Landing\Copilot\Data\Node;
5
6use Bitrix\Landing\Copilot\Data\Type\NodeType;
7
8class Link extends Node
9{
10 protected const TYPE = NodeType::Link;
11
12 private ?array $texts;
13 private ?array $href;
14 private ?array $target;
15 private ?array $genderData = null;
16
17 public function __construct(string $code, array $data)
18 {
19 parent::__construct($code, $data);
20 $this->texts = $data['values'] ?? [];
21 $this->href = $data['href'] ?? ['#'];
22 $this->target = $data['target'] ?? ['_blank'];
23 }
24
25 public function toArray(): array
26 {
27 $data = parent::toArray();
28 $data['genderData'] = $this->getGenderData();
29
30 return $data;
31 }
32
33 // todo: incorrect format. It is not data, it is setText
34 // todo: need check all nodes setData functions. I think in must be operations from constructor
35 public function setData(array $data): void
36 {
37 $this->setTexts($data);
38
39 if (isset($data['genderData']))
40 {
41 $this->genderData = $data['genderData'];
42 }
43 }
44
45 public function getValues(?int $position = null): array
46 {
47 $nodeDataArray = [];
48 foreach ($this->texts as $text)
49 {
50 $nodeDataArray[] = [
51 'text' => $text,
52 'href' => $this->href[0],
53 'target' => $this->target[0],
54 ];
55 }
56
57 return $nodeDataArray;
58 }
59
60 protected function setTexts(array $texts): void
61 {
62 $this->texts = $texts;
63 }
64
65 public function setGenderData(array $genderData): self
66 {
67 $this->genderData = $genderData;
68
69 return $this;
70 }
71
72 // todo: use trait for repeated methods
73 public function getGenderData(): ?array
74 {
75 return $this->genderData;
76 }
77}
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$text
Определения template_pdf.php:79