- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/blogpost.php
- Класс: BitrixSocialnetworkLivefeedBlogPost
- Вызов: BlogPost::getPinnedDescription
public function getPinnedDescription()
{
$result = '';
if (empty($this->sourceFields))
{
$this->initSourceFields();
}
$post = $this->getSourceFields();
if (empty($post))
{
return $result;
}
$result = truncateText(str_replace(''', "'", htmlspecialcharsBack(CTextParser::clearAllTags($post['DETAIL_TEXT']))), 100);
$result = preg_replace('/^' . (BitrixMainApplication::isUtfMode() ? "xC2xA0" : "xA0") . '$/', '', $result);
if (
$result === ''
&& Loader::includeModule('disk')
)
{
$fileNameList = [];
$res = BitrixDiskAttachedObject::getList([
'filter' => [
'=ENTITY_TYPE' => BitrixDiskUfBlogPostConnector::className(),
'ENTITY_ID' => $this->entityId
],
'select' => [ 'ID', 'FILENAME' => 'OBJECT.NAME' ]
]);
foreach ($res as $attachedObjectFields)
{
$fileNameList[] = $attachedObjectFields['FILENAME'];
}
$result = truncateText(implode(' ', $fileNameList), 100);
}
return $result;
}