Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
PropertyValue.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\PropertyValue
;
4
5
use
Bitrix\Catalog\v2\BaseEntity
;
6
15
class
PropertyValue
extends
BaseEntity
16
{
17
// ToDo property cast map (int)1 => '1'
18
public
function
setValue($value):
self
19
{
21
$property = $this->
getParent
();
22
23
if
($property->getPropertyType() ===
'S'
&& $property->getUserType() ===
'HTML'
)
24
{
25
$value = $this->
prepareValueForHtmlProperty
($value);
26
}
27
28
return
$this->
setField
(
'VALUE'
, $value);
29
}
30
31
// ToDo do we need to create HtmlProperty entity (descendant of PropertyValue)?
32
protected
function
prepareValueForHtmlProperty
($value)
33
{
34
if
(!is_array($value) || !isset($value[
'TYPE'
]))
35
{
36
$oldValue = $this->
getField
(
'VALUE'
);
37
$value = [
38
'TEXT'
=> $value,
39
'TYPE'
=> $oldValue[
'TYPE'
] ??
'HTML'
,
40
];
41
}
42
43
return
$value;
44
}
45
46
public
function
getValue
()
47
{
48
return
$this->
getField
(
'VALUE'
);
49
}
50
51
public
function
setDescription
($description): self
52
{
53
return
$this->
setField
(
'DESCRIPTION'
, $description);
54
}
55
56
public
function
getDescription
()
57
{
58
return
$this->
getField
(
'DESCRIPTION'
);
59
}
60
}
Bitrix\Catalog\v2\BaseEntity
Definition
BaseEntity.php:22
Bitrix\Catalog\v2\BaseEntity\setField
setField(string $name, $value)
Definition
BaseEntity.php:102
Bitrix\Catalog\v2\BaseEntity\getField
getField(string $name)
Definition
BaseEntity.php:119
Bitrix\Catalog\v2\BaseEntity\getParent
getParent()
Definition
BaseEntity.php:85
Bitrix\Catalog\v2\PropertyValue\PropertyValue
Definition
PropertyValue.php:16
Bitrix\Catalog\v2\PropertyValue\PropertyValue\getDescription
getDescription()
Definition
PropertyValue.php:56
Bitrix\Catalog\v2\PropertyValue\PropertyValue\setDescription
setDescription($description)
Definition
PropertyValue.php:51
Bitrix\Catalog\v2\PropertyValue\PropertyValue\prepareValueForHtmlProperty
prepareValueForHtmlProperty($value)
Definition
PropertyValue.php:32
Bitrix\Catalog\v2\PropertyValue\PropertyValue\getValue
getValue()
Definition
PropertyValue.php:46
Bitrix\Catalog\v2\PropertyValue
Definition
HasPropertyValueCollection.php:3
modules
catalog
lib
v2
PropertyValue
PropertyValue.php
Создано системой
1.10.0