- Модуль: forum
- Путь к файлу: ~/bitrix/modules/forum/lib/topic.php
- Класс: BitrixForumTopic
- Вызов: Topic::modifyData
static function modifyData(MainORMEvent $event, MainORMEventResult $result)
{
$data = array_merge($event->getParameter("fields"), $result->getModified());
$fields = [];
//region check image
$key = array_key_exists("VIEWS", $data) ? "VIEWS" : (array_key_exists("=VIEWS", $data) ? "=VIEWS" : null);
if ($key !== null && str_replace(" ", "", $data[$key]) === "VIEWS+1")
{
unset($data[$key]);
$fields["VIEWS"] = new MainDBSqlExpression('?# + 1', 'VIEWS');
}
//endregion
if (!empty($fields))
{
$result->modifyFields(array_merge($result->getModified(), $fields));
}
return $result;
}