- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/integration/ui/entityselector/projectprovider.php
- Класс: BitrixSocialnetworkIntegrationUIEntitySelectorProjectProvider
- Вызов: ProjectProvider::fillDialog
public function fillDialog(Dialog $dialog): void
{
$limit = 100;
$projects = $this->getProjectCollection(['limit' => $limit]);
$dialog->addItems($this->makeProjectItems($projects, ['tabs' => 'projects']));
/*
if ($projects->count() < $limit)
{
$entity = $dialog->getEntity('project');
if ($entity)
{
$entity->setDynamicSearch(false);
}
}
*/
$icon =
'data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20'.
'fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M11'.
'.934%202.213a.719.719%200%2001.719%200l3.103%201.79c.222.13.36.367.36.623V8.21a.719.71'.
'9%200%2001-.36.623l-3.103%201.791a.72.72%200%2001-.719%200L8.831%208.832a.719.719%200%'.
'2001-.36-.623V4.627c0-.257.138-.495.36-.623l3.103-1.791zM7.038%2010.605a.719.719%200%2'.
'001.719%200l3.103%201.792a.72.72%200%2001.359.622v3.583a.72.72%200%2001-.36.622l-3.102'.
'%201.792a.719.719%200%2001-.72%200l-3.102-1.791a.72.72%200%2001-.36-.623v-3.583c0-.257'.
'.138-.494.36-.622l3.103-1.792zM20.829%2013.02a.719.719%200%2000-.36-.623l-3.102-1.792a'.
'.719.719%200%2000-.72%200l-3.102%201.792a.72.72%200%2000-.36.622v3.583a.72.72%200%2000'.
'.36.622l3.103%201.792a.719.719%200%2000.719%200l3.102-1.791a.719.719%200%2000.36-.623v'.
'-3.583z%22%20fill%3D%22%23ABB1B8%22/%3E%3C/svg%3E';
$dialog->addTab(new Tab([
'id' => 'projects',
'title' => Loc::getMessage('SOCNET_ENTITY_SELECTOR_PROJECTS_TAB_TITLE'),
'stub' => true,
'icon' => [
'default' => $icon,
'selected' => str_replace('ABB1B8', 'fff', $icon),
//'default' => '/bitrix/js/socialnetwork/entity-selector/images/project-tab-icon.svg',
//'selected' => '/bitrix/js/socialnetwork/entity-selector/images/project-tab-icon-selected.svg'
]
]));
$onlyProjectsMode = count($dialog->getEntities()) === 1;
$fillRecentTab = (
$this->options['fillRecentTab'] === true ||
($this->options['fillRecentTab'] !== false && $onlyProjectsMode)
);
if ($fillRecentTab)
{
$this->fillRecentTab($dialog, $projects);
}
$createProjectLink =
$this->options['createProjectLink'] === true ||
($this->options['createProjectLink'] !== false && $onlyProjectsMode)
;
if ($createProjectLink && self::canCreateProject())
{
$footerOptions = [];
if ($dialog->getFooter() === 'BX.SocialNetwork.EntitySelector.Footer')
{
// Footer could be set from UserProvider
$footerOptions = $dialog->getFooterOptions() ?? [];
}
$footerOptions['createProjectLink'] = self::getCreateProjectUrl(UserProvider::getCurrentUserId());
$dialog->setFooter('BX.SocialNetwork.EntitySelector.Footer', $footerOptions);
}
}