TemplateFieldHandler::getFieldsToDb

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. TemplateFieldHandler
  4. getFieldsToDb
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/handler/templatefieldhandler.php
  • Класс: BitrixTasksControlHandlerTemplateFieldHandler
  • Вызов: TemplateFieldHandler::getFieldsToDb
public function getFieldsToDb(): array
{
	$fields = $this->fields;

	$tableFields = TemplateTable::getEntity()->getFields();

	foreach ($fields as $fieldName => $value)
	{
		if (!array_key_exists($fieldName, $tableFields))
		{
			unset($fields[$fieldName]);
			continue;
		}

		if (in_array($fieldName, self::DEPRECATED_FIELDS))
		{
			unset($fields[$fieldName]);
			continue;
		}

		if (preg_match('/^UF_/', $fieldName))
		{
			unset($fields[$fieldName]);
			continue;
		}

		if (
			$tableFields[$fieldName] instanceof DatetimeField
			&& !empty($value)
		)
		{
			$fields[$fieldName] = BitrixMainTypeDateTime::createFromUserTime($value);
		}

		if (is_array($value))
		{
			$fields[$fieldName] = serialize($value);
		}
	}

	return $fields;
}

Добавить комментарий