mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Disable link in TopicLabel
when contentContainer is not present (#7291)
* Disable link in `TopicLabel` when contentContainer is not present * Disable link in `TopicLabel` when contentContainer is not present
This commit is contained in:
parent
ddefcce052
commit
941e26d9d5
@ -7,6 +7,7 @@ HumHub Changelog
|
||||
- Fix #7281: SelfTest for DynamicConfig broken when not exist yet
|
||||
- Fix #7284: Content tag visibility
|
||||
- Enh #7287: Add `Template` virtual field
|
||||
- Enh #7291: Disable link in `TopicLabel` when contentContainer is not present
|
||||
|
||||
1.17.0-beta.1 (October 28, 2024)
|
||||
--------------------------------
|
||||
|
@ -23,12 +23,19 @@ class TopicLabel extends Label
|
||||
*/
|
||||
public static function forTopic(Topic $topic, ?ContentContainerActiveRecord $contentContainer = null)
|
||||
{
|
||||
$link = Link::withAction('', 'topic.addTopic')->options([
|
||||
'data-topic-id' => $topic->id,
|
||||
'data-topic-url' => $topic->getUrl($contentContainer ?: ContentContainerHelper::getCurrent()),
|
||||
]);
|
||||
$label = static::light($topic->name)
|
||||
->sortOrder(20)
|
||||
->color($topic->color)
|
||||
->icon('fa-star');
|
||||
|
||||
return static::light($topic->name)->sortOrder(20)->color($topic->color)->withLink($link)->icon('fa-star');
|
||||
if ($contentContainer = $contentContainer ?: ContentContainerHelper::getCurrent()) {
|
||||
$label->withLink(Link::withAction('', 'topic.addTopic')->options([
|
||||
'data-topic-id' => $topic->id,
|
||||
'data-topic-url' => $topic->getUrl($contentContainer),
|
||||
]));
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user