• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/file.php
  • Класс: BitrixLandingFile
  • Вызов: File::getFilesFromBlockContent
static function getFilesFromBlockContent($blockId, $content)
{
	$fileIds = array();
	// parse from content
	if (preg_match_all('/data-fileid[2x]{0,2}="([d]+)"/i', $content, $matches))
	{
		foreach ($matches[1] as $fid)
		{
			$fileIds[] = $fid;
		}
	}
	// check if files ids set in blockId
	if (!empty($fileIds))
	{
		$res = FileTable::getList(array(
			'select' => array(
				'FILE_ID'
			),
			'filter' => array(
				'FILE_ID' => $fileIds,
				'ENTITY_ID' => $blockId,
				'=ENTITY_TYPE' => self::ENTITY_TYPE_BLOCK
			)
		));
		$fileIds = array();
		while ($row = $res->fetch())
		{
			$fileIds[] = $row['FILE_ID'];
		}
	}
	return $fileIds;
}