We now display the channel in the sidebar

This commit is contained in:
Michael 2023-09-09 19:30:01 +00:00
parent d395de3aa1
commit 8050389d32
6 changed files with 46 additions and 4 deletions

View file

@ -547,4 +547,35 @@ class Widget
$accounttype
);
}
/**
* Get a list of all channels
*
* @param string $base
* @param string $channelname
* @param integer $uid
* @return string
*/
public static function channels(string $base, string $channelname, int $uid): string
{
$channels = [];
foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) {
$channels[] = ['ref' => $channel->code, 'name' => $channel->label];
}
foreach (DI::TimelineFactory()->getCommunities(true) as $community) {
$channels[] = ['ref' => $community->code, 'name' => $community->label];
}
return self::filter(
'channel',
DI::l10n()->t('Channels'),
'',
'',
$base,
$channels,
$channelname
);
}
}