3namespace Bitrix\Iblock\Integration\UI\EntityEditor;
5use Bitrix\Iblock\Helpers\Admin\Property;
6use Bitrix\Iblock\IblockTable;
7use Bitrix\Iblock\Integration\UI\EntityEditor\Property\PropertyFeatureEditorFields;
8use Bitrix\Iblock\Property\Type\PropertyTypeSettings;
9use Bitrix\Iblock\PropertyTable;
10use Bitrix\Main\Config\Option;
11use Bitrix\Main\Loader;
12use Bitrix\Main\Localization\Loc;
13use Bitrix\Main\NotImplementedException;
14use Bitrix\Main\Type\Collection;
15use Bitrix\UI\EntityEditor\BaseProvider;
17use CIBlockSectionPropertyLink;
28 private array $entity;
29 private string $propertyType;
30 private ?
string $userType;
39 public function __construct(
string $propertyType, ?
string $userType,
array $entityFields)
41 $this->propertyType = $propertyType;
42 $this->userType = $userType;
43 $this->entity = $entityFields;
45 $this->initEntityDefaultValues();
48 private function initEntityDefaultValues(): void
53 $name = $field[
'name'];
54 if (array_key_exists(
$name, $this->entity))
59 if (isset($field[
'default_value']))
61 $this->entity[
$name] = $field[
'default_value'];
63 elseif ($field[
'type'] ===
'boolean')
65 $this->entity[
$name] =
'N';
72 return $this->entity[
'ID'] ??
null;
77 return $this->entity[
'IBLOCK_ID'] ??
null;
84 $setValues = $this->getPropertyTypeSettings()->getSetValues();
85 if (!empty($setValues))
87 $values = array_merge($values, $setValues);
97 'name' =>
'PROPERTY_TYPE',
98 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_PROPERTY_TYPE'),
101 'items' => $this->getPropertyTypeItems(),
108 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_CODE'),
113 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_NAME'),
119 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_SORT'),
121 'default_value' => 100,
122 'hint' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_SORT_HINT'),
126 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_ACTIVE'),
128 'default_value' =>
'Y',
131 'name' =>
'MULTIPLE',
132 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_MULTIPLE'),
136 'name' =>
'IS_REQUIRED',
137 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_IS_REQUIRED'),
141 'name' =>
'SEARCHABLE',
142 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_SEARCHABLE'),
147 return $this->clearHiddenFields(
$fields);
154 'name' =>
'FILTRABLE',
155 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_FILTERABLE_MSGVER_1'),
159 'name' =>
'WITH_DESCRIPTION',
160 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_WITH_DESCRIPTION'),
164 'name' =>
'MULTIPLE_CNT',
165 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_MULTIPLE_CNT'),
170 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_HINT'),
174 'name' =>
'SECTION_PROPERTY',
175 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_SECTION_PROPERTY'),
179 'name' =>
'SMART_FILTER',
180 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_SMART_FILTER'),
184 'name' =>
'DISPLAY_TYPE',
185 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_DISPLAY_TYPE'),
188 'items' => $this->getDisplayTypeItems(),
192 'name' =>
'DISPLAY_EXPANDED',
193 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_DISPLAY_EXPANDED'),
197 'name' =>
'FILTER_HINT',
198 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_FILTER_HINT'),
199 'type' =>
'textarea',
202 'name' =>
'ROW_COUNT',
203 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_ROW_COUNT'),
207 'name' =>
'COL_COUNT',
208 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_COL_COUNT'),
212 'name' =>
'FILE_TYPE',
213 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_FILE_TYPE'),
217 'name' =>
'LINK_IBLOCK_ID',
218 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_LINK_IBLOCK_ID'),
221 'items' => $this->getLinkIblockIdItems(),
225 'name' =>
'LIST_TYPE',
226 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_LIST_TYPE'),
229 'items' => $this->getListTypeItems(),
234 if (Option::get(
'iblock',
'show_xml_id') ===
'Y')
238 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_XML_ID'),
244 $html = $this->getPropertyTypeSettings()->getDefaultValueHtml();
248 'name' =>
'DEFAULT_VALUE',
249 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_DEFAULT_VALUE'),
259 'name' =>
'DEFAULT_VALUE',
260 'title' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_DEFAULT_VALUE'),
266 $futureFields = $this->getPropertyFeatureEditorFields();
267 if ($futureFields->isHasFields())
269 array_push(
$fields, ... $futureFields->getEntityFields());
272 return $this->clearHiddenFields(
$fields);
279 function(
array $item)
283 && $this->getPropertyTypeSettings()->isShownField($item[
'name'])
291 return $this->getPropertyTypeSettings()->getSettingsHtml();
305 return $this->futureEditor;
313 private function getPropertyTypeSettings(): PropertyTypeSettings
315 if (isset($this->typeSettings))
317 return $this->typeSettings;
320 if (isset($this->userType))
326 $this->typeSettings =
new PropertyTypeSettings($this->propertyType,
null);
329 return $this->typeSettings;
337 private function getDisplayTypeItems():
array
341 $types = CIBlockSectionPropertyLink::getDisplayTypes($this->propertyType, $this->userType);
353 private function hideSkuProperty(): bool
380 return (
int)
$catalog[
'SKU_PROPERTY_ID'] > 0;
391 private function getPropertyTypeItems():
array
395 $baseTypes = Property::getBaseTypeList(
true);
405 if ($this->hideSkuProperty())
409 Collection::sortByColumn($userTypes, [
410 'DESCRIPTION' => SORT_STRING,
413 foreach ($userTypes as
$type => $item)
416 'NAME' => $item[
'DESCRIPTION'],
417 'VALUE' =>
"{$item['PROPERTY_TYPE']}:{$type}",
429 private function getListTypeItems():
array
434 'NAME' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_LIST_TYPE_CHECKBOX'),
438 'NAME' => Loc::getMessage(
'IBLOCK_ENTITY_EDITOR_PROPERTY_LIST_TYPE_LISTBOX'),
450 private function getLinkIblockIdItems():
array
458 $iblockId = ($this->entity[
'IBLOCK_ID'] ?? 0);
468 'TYPE_NAME' =>
'TYPE.LANG_MESSAGE.NAME',
472 foreach (
$rows as $row)
475 'NAME' =>
"{$row['TYPE_NAME']}. {$row['NAME']}",
476 'VALUE' => $row[
'ID'],
483 #region not used parent methods
505 #endregion not used parent methods
__construct(string $propertyType, ?string $userType, array $entityFields)
static createByUserType(string $propertyType, string $userType, array $propertyFields, ?string $htmlName='USER_TYPE_SETTINGS')
static requireModule($moduleName)
static includeModule($moduleName)
static getList(array $parameters=array())
static GetUserType($USER_TYPE=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)