aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/contentmodules.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/course/contentmodules.php')
-rw-r--r--app/controllers/course/contentmodules.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/course/contentmodules.php b/app/controllers/course/contentmodules.php
index 923c61b..d37d1bb 100644
--- a/app/controllers/course/contentmodules.php
+++ b/app/controllers/course/contentmodules.php
@@ -261,14 +261,19 @@ 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)
{
$list = [];
- foreach (PluginEngine::getPlugins('StudipModule') as $plugin) {
+ foreach (PluginEngine::getPlugins(StudipModule::class) as $plugin) {
if (!$plugin->isActivatableForContext($context)) {
continue;
}
@@ -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