403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/catalog/lib/v2/PropertyValue/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/catalog/lib/v2/PropertyValue/PropertyValue.php
<?php

namespace Bitrix\Catalog\v2\PropertyValue;

use Bitrix\Catalog\v2\BaseEntity;

/**
 * Class PropertyValue
 *
 * @package Bitrix\Catalog\v2\PropertyValue
 *
 * !!! This API is in alpha stage and is not stable. This is subject to change at any time without notice.
 * @internal
 */
class PropertyValue extends BaseEntity
{
	// ToDo property cast map (int)1 => '1'
	public function setValue($value): self
	{
		/** @var \Bitrix\Catalog\v2\Property\Property $property */
		$property = $this->getParent();

		if ($property->getPropertyType() === 'S' && $property->getUserType() === 'HTML')
		{
			$value = $this->prepareValueForHtmlProperty($value);
		}

		return $this->setField('VALUE', $value);
	}

	// ToDo do we need to create HtmlProperty entity (descendant of PropertyValue)?
	protected function prepareValueForHtmlProperty($value)
	{
		if (!is_array($value) || !isset($value['TYPE']))
		{
			$oldValue = $this->getField('VALUE');
			$value = [
				'TEXT' => $value,
				'TYPE' => $oldValue['TYPE'] ?? 'HTML',
			];
		}

		return $value;
	}

	public function getValue()
	{
		return $this->getField('VALUE');
	}

	public function setDescription($description): self
	{
		return $this->setField('DESCRIPTION', $description);
	}

	public function getDescription()
	{
		return $this->getField('DESCRIPTION');
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit