Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
layout.php
1<?php
2
4
7
11final class Layout
12{
13 private Column $column;
14 private bool $hasLeftAlignedCounter = false;
15
19 public function __construct(Column $column)
20 {
21 $this->column = $column;
22 }
23
31 public function setHasLeftAlignedCounter(bool $value): self
32 {
33 $this->hasLeftAlignedCounter = $value;
34
35 return $this;
36 }
37
43 public function isHasLeftAlignedCounter(): bool
44 {
45 return $this->hasLeftAlignedCounter;
46 }
47
53 public function getCellAttributes(): Attributes
54 {
55 $result = new Attributes();
56
57 $value = $this->column->getTitle();
58 if (!empty($value))
59 {
60 $result->set('title', $value);
61 }
62
63 $value = $this->column->getCssColorClassName();
64 if (!empty($value))
65 {
66 $result->set('class', $value);
67 }
68
69 $value = $this->getColumnStyle();
70 if (!empty($value))
71 {
72 $result->set('style', $value);
73 }
74
75 $result->setData('name', $this->column->getId());
76 $result->setData('sort-by', $this->column->getSort());
77 $result->setData('sort-url', $this->column->getSortUrl());
78 $result->setData('sort-order', $this->column->getNextSortOrder());
79
80 $editable = $this->column->getEditable();
81 if (isset($editable))
82 {
83 $result->setData('edit', $editable->toArray());
84 }
85 else
86 {
87 $result->setData('edit', false);
88 }
89
90 return $result;
91 }
92
98 private function getColumnStyle(): string
99 {
100 $result = '';
101
102 $width = $this->column->getWidth();
103 if (isset($width))
104 {
105 $result .= " width:{$width}px;";
106 }
107
108 $colorValue = $this->column->getCssColorValue();
109 if (isset($colorValue))
110 {
111 $result .= " background-color:{$colorValue};";
112 }
113
114 return trim($result);
115 }
116
123 {
124 $result = new Attributes();
125
126 $value = $this->getContainerStyle();
127 if (!empty($value))
128 {
129 $result->set('style', $value);
130 }
131
132 return $result;
133 }
134
140 private function getContainerStyle(): string
141 {
142 $result = '';
143
144 $width = $this->column->getWidth();
145 if (isset($width))
146 {
147 $result .= "width:{$width}px;";
148 }
149
150 return $result;
151 }
152}
setHasLeftAlignedCounter(bool $value)
Definition layout.php:31