aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/contentmodules.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-04-25 13:39:35 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-04-25 13:39:35 +0000
commit0b282700b7c76784658cb94845361ae72f6a4f26 (patch)
tree0efa9a9475e6eede611ac82b90e18bf8e8d554ca /app/controllers/course/contentmodules.php
parent8d696407e1b3fed3b4bf54951c889ea75290897e (diff)
fixes #4077
Closes #4077 Merge request studip/studip!2920
Diffstat (limited to 'app/controllers/course/contentmodules.php')
-rw-r--r--app/controllers/course/contentmodules.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/controllers/course/contentmodules.php b/app/controllers/course/contentmodules.php
index 923c61b..df397cd 100644
--- a/app/controllers/course/contentmodules.php
+++ b/app/controllers/course/contentmodules.php
@@ -261,7 +261,12 @@ class Course_ContentmodulesController extends AuthenticatedController
}
}
- PageLayout::setTitle(sprintf(_('Informationen über %s'), $this->metadata['displayname']));
+ $this->metadata['icon'] = $this->getIconFromMetadata($this->metadata, $this->plugin);
+
+ PageLayout::setTitle(sprintf(
+ _('Informationen über %s'),
+ $this->metadata['displayname'] ?? $this->plugin->getPluginName()
+ ));
}
private function getModules(Range $context)
@@ -291,6 +296,7 @@ class Course_ContentmodulesController extends AuthenticatedController
$visibility = $tool ? $tool->getVisibilityPermission() : 'nobody';
$metadata = $plugin->getMetadata();
+ $icon = $this->getIconFromMetadata($metadata, $plugin);
$list[$plugin_id] = [
'id' => $plugin_id,
'moduleclass' => get_class($plugin),
@@ -299,7 +305,7 @@ class Course_ContentmodulesController extends AuthenticatedController
'displayname' => $displayname,
'visibility' => $visibility,
'active' => (bool) $tool,
- 'icon' => $this->getIconFromMetadata($metadata, $plugin),
+ 'icon' => $icon ? $icon->asImagePath() : null,
'summary' => $metadata['summary'] ?? null,
'mandatory' => $this->sem_class->isModuleMandatory(get_class($plugin)),
'highlighted' => (bool) $plugin->isHighlighted(),
@@ -315,7 +321,7 @@ class Course_ContentmodulesController extends AuthenticatedController
* @param array $metadata
* @param CorePlugin|StudIPPlugin $plugin
*/
- private function getIconFromMetadata(array $metadata, $plugin): ?string
+ private function getIconFromMetadata(array $metadata, $plugin): ?Icon
{
$icon = $metadata['icon_clickable'] ?? $metadata['icon'] ?? null;
@@ -332,7 +338,7 @@ class Course_ContentmodulesController extends AuthenticatedController
$icon = Icon::create($plugin->getPluginURL() . '/' . $icon);
}
- return $icon->copyWithRole(Icon::ROLE_CLICKABLE)->asImagePath();
+ return $icon->copyWithRole(Icon::ROLE_CLICKABLE);
}
private function getCoreIcon(string $path): ?Icon