This commit is contained in:
2024-04-03 06:25:04 +03:00
parent 667cf886d5
commit 0fe261d345
17 changed files with 144 additions and 46 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* @var Shell $this
* @var DefaultField $field
*/
use Wt\Core\Entity\UserFieldEntity;
use Wt\Core\Form\Field\DefaultField;
use Wt\Core\Templater\Shell;
require_once app()->module()->getDir() . '/templates/admin_bitrix_assets.php';
global $USER_FIELD_MANAGER;
/** @var UserFieldEntity $propertyEntity */
$propertyEntity = $field->getPropertyEntity();
$property_fields = $propertyEntity->getRaw();
$arUserField['EDIT_FORM_LABEL'] = $property_fields['EDIT_FORM_LABEL']?: $property_fields['FIELD_NAME'];
$property_fields['USER_TYPE'] = $propertyEntity->getUserTypeBuild();
$property_fields['VALUE'] = $field->getValue();
if($field->isNew()){
$property_fields['VALUE'] = $field->getPropertyEntity()->getDefaultValue();
}
$property_fields['ENTITY_VALUE_ID'] = $property_fields['VALUE_ID'] = $field->getParentEntityId();
//$arUserFields = $USER_FIELD_MANAGER->GetUserFields($field->getPropertyEntity()->getRaw('ENTITY_ID'), $property_fields['ENTITY_VALUE_ID'], LANGUAGE_ID);
//pre($arUserFields[$propertyEntity->getCode()]['VALUE']);
echo $USER_FIELD_MANAGER->GetEditFormHTML(false, $field->getValue(), $property_fields);
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php
@@ -0,0 +1,73 @@
<?php
/**
* @var Shell $this
* @var DefaultField $field
* @var PropertyEntity $propertyEntity
*/
use Wt\Core\Entity\IBlock\PropertyEntity;
use Wt\Core\Form\Field\DefaultField;
use Wt\Core\Templater\Shell;
require_once app()->module()->getDir() . '/templates/admin_bitrix_assets.php';
$propertyEntity = $field->getPropertyEntity();
?>
<tr>
<td width="30%" class="adm-detail-content-cell-l"><?=$field->getLabel()?></td>
<td class="adm-detail-content-cell-r"><?php
$restoredValue = $field->getPropertyValue()->getRestoredValue();
$extValues = [];
if($field->isMultiple()){
foreach ($restoredValue['VALUE'] as $k => $v){
if($v){
$extValues[$k] = ['VALUE' => $v, 'DESCRIPTION' => (string)$restoredValue['DESCRIPTION'][$k]];
}
}
} else {
if($restoredValue['VALUE']){
$extValues[] = ['VALUE' => $restoredValue['VALUE'], 'DESCRIPTION' => (string)$restoredValue['DESCRIPTION']];
}
}
if($field->isMultiple() ){
$shortValues = $field->getValue();
} else {
$shortValues = [];
$value = $field->getValue();
if(mb_strlen($value)){
$shortValues = (array)$value;
}
}
if($propertyEntity->isWithDescription()) {
$values = $extValues;
} else {
$values = $shortValues;
}
$property_fields = $propertyEntity->getRaw();
$property_fields['USER_TYPE_SETTINGS'] = $propertyEntity->getSettings();
if($propertyEntity->getUserType()){
$property_fields['VALUE'] = $shortValues;
$property_fields['~VALUE'] = $extValues;
}
unset($property_fields['USER_TYPE_SETTINGS_LIST']);
_ShowPropertyField(
$field->getName(),
$property_fields,
$values,
$field->isNew(),
false,
50000,
$field->getForm()->getName(),
false
);
?></td>
</tr>
@@ -0,0 +1 @@
<?php
@@ -0,0 +1 @@
<?php
-28
View File
@@ -1,28 +0,0 @@
<?php
/**
* @var \Wt\Core\Templater\Shell $this
* @var \Wt\Core\Form\Field\DefaultField $field
*/
use Bitrix\Main\Page\Asset;
use Wt\Core\Templater\Tools;
\Bitrix\Main\Loader::includeModule('iblock');
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/iblock/prolog.php");
Bitrix\Main\Page\Asset::getInstance()->addJs('/bitrix/js/iblock/iblock_edit.js');
Asset::getInstance()->addJs("/bitrix/js/main/core/core.js");
\Bitrix\Main\UI\Extension::load(array("popup", "ajax", "ui.buttons", "ui.forms", "main.polyfill.core", "color_picker"));
$bLabel = mb_strlen($field->getLabel());
$labelAttrs = [];
if(mb_strlen($field->getId())){
$labelAttrs['for'] = $field->getId();
}
if($bLabel){?><label <?=Tools::getAttrByArray($labelAttrs)?>><?=$field->getLabel()?></label><?}
$inputAttributes = $field->getAttributes();
$inputAttributes['data-dirty'] = $field->isDirty()?'true':'false';
if($field->isMultiple()){
$inputAttributes['name'] = preg_replace('/\[]$/', '', $inputAttributes['name']) . '[]';
}
unset($inputAttributes['options']);
_ShowPropertyField($field->getName(), $field->getPropertyEntity()->getRaw(), [], false, false, 50000, $field->getForm()->getName(), false);
echo "\n\r";
-18
View File
@@ -1,18 +0,0 @@
<?php
/**
* @var \Wt\Core\Templater\Shell $this
* @var \Wt\Core\Form\Field\DefaultField $field
*/
use Wt\Core\Templater\Tools;
$bLabel = mb_strlen($field->getLabel());
$labelAttrs = [];
if(mb_strlen($field->getId())){
$labelAttrs['for'] = $field->getId();
}
if($bLabel){?><label <?=Tools::getAttrByArray($labelAttrs)?>><?=$field->getLabel()?></label><?}
$inputAttributes = $field->getAttributes();
$inputAttributes['data-dirty'] = $field->isDirty()?'true':'false';
?><input <?=Tools::getAttrByArray($inputAttributes)?>><?
echo "\n\r";
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* @var \Wt\Core\Templater\Shell $this
* @var \Wt\Core\Form\Field\DefaultField $field
*/
use Wt\Core\Templater\Tools;
$bLabel = mb_strlen($field->getLabel());
$labelAttrs = [];
if(mb_strlen($field->getId())){
$labelAttrs['for'] = $field->getId();
}
if($bLabel){?><label <?=Tools::getAttrByArray($labelAttrs)?>><?=$field->getLabel()?></label><?}
if($field->isMultiple()){
foreach ($field->getValue() as $value){
$inputAttributes = $field->getAttributes();
$inputAttributes['name'] .= '[]';
$inputAttributes['value'] = $value;
?><input <?=Tools::getAttrByArray($inputAttributes)?>><?
echo "\n\r";
}
$inputAttributes = $field->getAttributes();
$inputAttributes['name'] .= '[]';
$inputAttributes['value'] = '';
?><input <?=Tools::getAttrByArray($inputAttributes)?>><?
echo "\n\r";
} else {
$inputAttributes = $field->getAttributes();
$inputAttributes['data-dirty'] = $field->isDirty()?'true':'false';
?><input <?=Tools::getAttrByArray($inputAttributes)?>><?
echo "\n\r";
}
+1
View File
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php
+1
View File
@@ -0,0 +1 @@
<?php