48 private static ?
array $fields =
null;
71 if (!static::isAllowed())
77 'ID' => static::getFieldId(),
78 'TYPE' => static::getTypeId(),
79 'TITLE' => static::getTitle(),
99 $result = static::getTitleInternal();
101 return (
$result ?? static::getUserFieldName(static::getFieldId()));
110 $row = static::load();
116 if (!static::isAllowed())
118 return static::getCommonError(
'CATALOG_SYSTEMFIELD_ERR_DISALLOWED_FIELD');
128 return static::getCommonError(
'CATALOG_SYSTEMFIELD_ERR_BAD_FIELD_DESCRIPTION');
132 return static::getCommonError(
'CATALOG_SYSTEMFIELD_ERR_BAD_FIELD_TYPE');
140 return static::getCommonError(
'CATALOG_SYSTEMFIELD_ERR_BAD_CONFIG_DESCRIPTION');
146 static::updateProductFormConfiguration();
156 return static::TYPE_ID;
161 return static::FIELD_ID;
166 if (self::$bitrix24Include ===
null)
168 self::$bitrix24Include = Loader::includeModule(
'bitrix24');
171 return self::$bitrix24Include;
176 return self::FIELD_PREFIX.$id;
186 if (self::$languages ===
null)
188 self::$languages = [];
191 'filter' => [
'=ACTIVE' =>
'Y']
195 self::$languages[] = $row[
'ID'];
200 return self::$languages;
205 $messageList = array_fill_keys(array_keys($messageIds), []);
209 $mess = Loc::loadLanguageFile($file, $languageId);
210 foreach ($messageIds as $index => $phrase)
212 $message = (string)($mess[$phrase] ??
null);
215 $messageList[$index][$languageId] =
$message;
230 [
'#TITLE#' => static::getTitle()]
238 if (!static::isAllowed())
259 $actionConfig = static::getGridActionConfig(
$panel);
260 if ($actionConfig ===
null)
267 return $className::getGridAction($actionConfig);
277 if (self::$fields ===
null)
281 $className = get_called_class();
282 if (!array_key_exists($className, self::$fields))
284 self::$fields[$className] = self::loadInternal($className);
287 return self::$fields[$className];
292 self::$languages =
null;
293 self::$fields =
null;
294 self::$allowedProductTypeList =
null;
295 self::$allowedOperations =
null;
298 private static function loadInternal(
string $className): ?
array
301 $config = $className::getUserFieldBaseParam();
306 if (
$config[
'USER_TYPE_ID'] ===
null)
312 'select' => array_merge(
317 '=ENTITY_ID' =>
$config[
'ENTITY_ID'],
318 '=FIELD_NAME' =>
$config[
'FIELD_NAME'],
319 '=USER_TYPE_ID' =>
$config[
'USER_TYPE_ID'],
330 return static::afterLoadInternalModify($row);
338 $row[
'ID'] = (int)$row[
'ID'];
339 $row[
'SORT'] = (int)$row[
'SORT'];
343 if ($fieldName ===
'LANGUAGE_ID')
345 unset($row[$fieldName]);
349 if (isset($row[$fieldName]) && $row[$fieldName] ===
'')
351 $row[$fieldName] =
null;
361 if (self::$allowedProductTypeList ===
null)
363 self::$allowedProductTypeList = [];
365 $className = get_called_class();
366 if (!isset(self::$allowedProductTypeList[$className]))
368 self::$allowedProductTypeList[$className] = static::getAllowedProductTypeList();
371 return in_array(
$type, self::$allowedProductTypeList[$className],
true);
381 if (isset($restrictions[
'TYPE']))
383 if (!static::checkAllowedProductType($restrictions[
'TYPE']))
394 $field = static::getUserFieldBaseParam();
395 $requestName =
$panel->getFormRowFieldName($field[
'FIELD_NAME']);
396 $value = Main\Context::getCurrent()->getRequest()->get($requestName);
402 if ($field[
'MULTIPLE'] ===
'Y' && !is_array($value))
407 return [$field[
'FIELD_NAME'] => $value];
412 if (self::$allowedOperations ===
null)
414 self::$allowedOperations = [];
416 $className = get_called_class();
417 if (!isset(self::$allowedOperations[$className]))
419 self::$allowedOperations[$className] = array_fill_keys(static::getAllowedOperations(),
true);
422 return isset(self::$allowedOperations[$className][$operation]);
442 if (!static::isAllowed())
446 if (!static::checkRestictions($product))
450 if (!static::isExists())
456 $request = Main\Context::getCurrent()->getRequest();
458 return $userFieldManager->GetEditFormHTML(
460 $request->getPost($field[
'FIELD_NAME']) ??
'',
469 && static::checkRestictions($restrictions)
470 && static::isExists()
473 $userField = static::load();
474 if ($userField ===
null)
480 'entity' =>
'product',
481 'name' => $userField[
'FIELD_NAME'],
482 'originalName' => $userField[
'FIELD_NAME'],
483 'title' => $userField[
'EDIT_FORM_LABEL'] ?? $userField[
'FIELD_NAME'],
484 'hint' => $userField[
'HELP_MESSAGE'],
486 'required' => $userField[
'MANDATORY'] ===
'Y',
487 'multiple' => $userField[
'MULTIPLE'] ===
'Y',
488 'placeholders' =>
null,
489 'defaultValue' => $userField[
'SETTINGS'][
'DEFAULT_VALUE'] ??
'',
492 'showCode' =>
'true',
497 return static::getUiDescriptionInternal(
$description, $userField, $restrictions);
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static getUiDescriptionInternal(array $description, array $userField, array $restrictions)
static getAllowedProductTypeList()
static getTitleInternal()
static getAllowedOperations()
static array $allowedProductTypeList
static prepareValue(string $operation, array $productRow)
static checkAllowedProductType(int $type)
static getUserFieldBaseParam()
static getGroupActionRequest(ProductGroupAction $panel)
static getCommonError(string $errorCode)
static getOperationSelectFieldList(string $operation)
static getUserFieldName(string $id)
static array $allowedOperations
static checkAllowedOperation(string $operation)
static getGridActionConfig(ProductGroupAction $panel)
static renderAdminFormControl(array $field, array $product, array $config)
static afterLoadInternalModify(array $row)
static updateProductFormConfiguration()
static bool $bitrix24Include
static checkRestictions(array $restrictions)
static getUiDescription(array $restrictions)
static getGridAction(ProductGroupAction $panel)
static getMessages(string $file, array $messageIds)
static getList(array $parameters=array())
static getLabelsSelect(string $referenceName=null)
static getLabelsReference(string $referenceName=null, string $languageId=null)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description