public function processEditAction()
 {
     if ($this->getSettings('MULTIPLE')) {
         $sphere = $this->data[$this->getCode()];
         unset($this->data[$this->getCode()]);
         foreach ($sphere as $sphereKey) {
             $this->data[$this->getCode()][] = ['VALUE' => $sphereKey];
         }
     }
     parent::processEditAction();
 }
 /**
  * {@inheritdoc}
  */
 public function processEditAction()
 {
     parent::processEditAction();
     if ($this->getSettings('MULTIPLE')) {
         if ($this->getSettings('READONLY') === true) {
             //удаляем все добавленные файлы в режиме только для чтения
             foreach ($this->data[$this->code] as $key => $value) {
                 if (!is_array($value)) {
                     unset($this->data[$this->code][$key]);
                 }
             }
             return false;
         }
         if (class_exists('\\Bitrix\\Main\\UI\\FileInput', true) && $this->getSettings('IMAGE') === true) {
             foreach ($this->data[$this->code] as $key => $value) {
                 if (is_array($value) && ($value['name'] || $value['tmp_name'])) {
                     $_FILES[$this->code]['name'][$key] = $value['name'];
                     $_FILES[$this->code]['type'][$key] = $value['type'];
                     $_FILES[$this->code]['tmp_name'][$key] = $value['tmp_name'];
                     $_FILES[$this->code]['error'][$key] = $value['error'];
                     $_FILES[$this->code]['size'][$key] = $value['size'];
                     unset($this->data[$this->code][$key]);
                 } else {
                     $_FILES[$this->code]['name'][$key] = '';
                 }
             }
             if (!count($this->data[$this->code])) {
                 unset($this->data[$this->code]);
             }
         }
         if (!empty($_FILES[$this->getCode()])) {
             foreach ($_FILES[$this->getCode()]['name'] as $key => $fileName) {
                 if (empty($fileName) || empty($_FILES[$this->getCode()]['tmp_name'][$key]) || !empty($_FILES[$this->getCode()]['error'][$key])) {
                     if (isset($_REQUEST[$this->getCode() . '_del'][$key])) {
                         if (is_array($this->data[$this->getCode()][$key]) && !empty($this->data[$this->getCode()][$key]['VALUE'])) {
                             \CFile::Delete(intval($this->data[$this->getCode()][$key]['VALUE']));
                         } else {
                             \CFile::Delete(intval($this->data[$this->getCode()][$key]));
                         }
                         unset($this->data[$this->getCode()][$key]);
                     } elseif ($this->data[$this->getCode()][$key]['VALUE']) {
                         \CFile::UpdateDesc($this->data[$this->getCode()][$key]['VALUE'], $_REQUEST[$this->getCode() . '_descr'][$key]);
                     }
                     continue;
                 } elseif (is_int($key)) {
                     //Удаляем старый файл при замене
                     if (is_array($this->data[$this->getCode()][$key]) && !empty($this->data[$this->getCode()][$key]['VALUE'])) {
                         \CFile::Delete(intval($this->data[$this->getCode()][$key]['VALUE']));
                     } else {
                         \CFile::Delete(intval($this->data[$this->getCode()][$key]));
                     }
                 }
                 $description = null;
                 if (isset($_REQUEST[$this->getCode() . '_descr'][$key])) {
                     $description = $_REQUEST[$this->getCode() . '_descr'][$key];
                 }
                 if (empty($this->data[$this->getCode()][$key])) {
                     unset($this->data[$this->getCode()][$key]);
                 }
                 $fileId = $this->saveFile($fileName, $_FILES[$this->getCode()]['tmp_name'][$key], false, $description);
                 if ($fileId) {
                     $this->data[$this->getCode()][$key] = array('VALUE' => $fileId);
                 } else {
                     $this->addError('DIGITALWAND_AH_FAIL_ADD_FILE', array('FILE_NAME' => $_FILES[$this->getCode()]['name'][$key]));
                 }
             }
         }
     } else {
         if (class_exists('\\Bitrix\\Main\\UI\\FileInput', true) && $this->getSettings('IMAGE') === true) {
             if (is_array($this->data[$this->code . '_FILE']) && ($this->data[$this->code . '_FILE']['name'] || $this->data[$this->code . '_FILE']['tmp_name'])) {
                 $_FILES['FIELDS']['name'][$this->code . '_FILE'] = $this->data[$this->code . '_FILE']['name'];
                 $_FILES['FIELDS']['type'][$this->code . '_FILE'] = $this->data[$this->code . '_FILE']['type'];
                 $_FILES['FIELDS']['tmp_name'][$this->code . '_FILE'] = $this->data[$this->code . '_FILE']['tmp_name'];
                 $_FILES['FIELDS']['error'][$this->code . '_FILE'] = $this->data[$this->code . '_FILE']['error'];
                 $_FILES['FIELDS']['size'][$this->code . '_FILE'] = $this->data[$this->code . '_FILE']['size'];
             }
         }
         unset($this->data[$this->code . '_FILE']);
         if ($this->getSettings('READONLY') === true) {
             return false;
         }
         if (empty($_FILES['FIELDS']['name'][$this->code . '_FILE']) || empty($_FILES['FIELDS']['tmp_name'][$this->code . '_FILE']) || !empty($_FILES['FIELDS']['error'][$this->code . '_FILE'])) {
             if (isset($_REQUEST['FIELDS_del'][$this->code . '_FILE']) and $_REQUEST['FIELDS_del'][$this->code . '_FILE'] == 'Y') {
                 \CFile::Delete(intval($this->data[$this->code]));
                 $this->data[$this->code] = 0;
             } elseif ($this->data[$this->code] && isset($_REQUEST['FIELDS_descr'][$this->code . '_FILE'])) {
                 \CFile::UpdateDesc($this->data[$this->code], $_REQUEST['FIELDS_descr'][$this->code . '_FILE']);
             }
             return false;
         }
         $description = null;
         if (isset($_REQUEST['FIELDS_descr'][$this->code . '_FILE'])) {
             $description = $_REQUEST['FIELDS_descr'][$this->code . '_FILE'];
         }
         $name = $_FILES['FIELDS']['name'][$this->code . '_FILE'];
         $path = $_FILES['FIELDS']['tmp_name'][$this->code . '_FILE'];
         $type = $_FILES['FIELDS']['type'][$this->code . '_FILE'];
         $this->saveFile($name, $path, $type, $description);
     }
 }
 /**
  * @inheritdoc
  */
 public function processEditAction()
 {
     parent::processEditAction();
     if ($this->getCheckboxType() === static::TYPE_BOOLEAN) {
         $this->data[$this->getCode()] = (bool) $this->data[$this->getCode()];
     }
 }
 public function processEditAction()
 {
     parent::processEditAction();
     if ($this->getSettings('MULTIPLE')) {
         if (!empty($_FILES[$this->getCode()])) {
             foreach ($_FILES[$this->getCode()]['name'] as $key => $fileName) {
                 if (empty($fileName) || empty($_FILES[$this->getCode()]['tmp_name'][$key]) || !empty($_FILES[$this->getCode()]['error'][$key])) {
                     continue;
                 }
                 $description = null;
                 if (isset($this->data[$this->getCode()][$key]['DESCRIPTION'])) {
                     $description = $this->data[$this->getCode()][$key]['DESCRIPTION'];
                     unset($this->data[$this->getCode()][$key]['DESCRIPTION']);
                 }
                 if (empty($this->data[$this->getCode()][$key])) {
                     unset($this->data[$this->getCode()][$key]);
                 }
                 $fileId = $this->saveFile($fileName, $_FILES[$this->getCode()]['tmp_name'][$key], false, $description);
                 if ($fileId) {
                     $this->data[$this->getCode()][] = ['VALUE' => $fileId];
                 } else {
                     ShowError('Не удалось добавить файл ' . $_FILES[$this->getCode()]['name'][$key]);
                 }
             }
         }
     } else {
         if (isset($_REQUEST['FIELDS_del'][$this->code . '_FILE']) and $_REQUEST['FIELDS_del'][$this->code . '_FILE'] == 'Y') {
             \CFile::Delete(intval($this->data[$this->code]));
             $this->data[$this->code] = 0;
         } else {
             if (isset($_REQUEST['FIELDS']['IMAGE_ID_FILE'])) {
                 $name = $_FILES['FIELDS']['name'][$this->code . '_FILE'];
                 $path = $_REQUEST['FIELDS']['IMAGE_ID_FILE'];
                 $this->saveFile($name, $path);
             } else {
                 $name = $_FILES['FIELDS']['name'][$this->code . '_FILE'];
                 $path = $_FILES['FIELDS']['tmp_name'][$this->code . '_FILE'];
                 $type = $_FILES['FIELDS']['type'][$this->code . '_FILE'];
                 $this->saveFile($name, $path, $type);
             }
         }
     }
 }
 /**
  * Если запрашивается модель, и если модель явно не указана, то берется модель текущего хэлпера, сохраняется для
  * последующего использования и возарвщвется пользователю.
  *
  * @param string $name
  * @return array|\Bitrix\Main\Entity\DataManager|mixed|string
  */
 public function getSettings($name = '')
 {
     $value = parent::getSettings($name);
     if (!$value) {
         if ($name == 'MODEL') {
             $value = $this->helper->getModel();
             $this->setSetting($name, $value);
         } else {
             if ($name == 'TITLE') {
                 $context = $this->helper->getContext();
                 $info = $this->getUserFieldInfo();
                 if (($context == AdminListHelper::OP_ADMIN_VARIABLES_FILTER or $context == AdminListHelper::OP_CREATE_FILTER_FORM) and (isset($info['LIST_FILTER_LABEL']) and !empty($info['LIST_FILTER_LABEL']))) {
                     $value = $info['LIST_FILTER_LABEL'];
                 } else {
                     if ($context == AdminListHelper::OP_ADMIN_VARIABLES_HEADER and isset($info['LIST_COLUMN_LABEL']) and !empty($info['LIST_COLUMN_LABEL'])) {
                         $value = $info['LIST_COLUMN_LABEL'];
                     } else {
                         if ($context == AdminEditHelper::OP_SHOW_TAB_ELEMENTS and isset($info['EDIT_FORM_LABEL']) and !empty($info['EDIT_FORM_LABEL'])) {
                             $value = $info['EDIT_FORM_LABEL'];
                         } else {
                             $value = $info['FIELD_NAME'];
                         }
                     }
                 }
             }
         }
     }
     return $value;
 }