Skip to content
Snippets Groups Projects
Commit 6f603e5e authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Werkzeuge: Info-Dialoge für Plugins zeigen keine Bilder an"

Closes #2847

Merge request studip/studip!1934
parent 62e4affa
No related branches found
No related tags found
No related merge requests found
...@@ -231,6 +231,34 @@ class Course_ContentmodulesController extends AuthenticatedController ...@@ -231,6 +231,34 @@ class Course_ContentmodulesController extends AuthenticatedController
{ {
$this->plugin = PluginManager::getInstance()->getPluginById($plugin_id); $this->plugin = PluginManager::getInstance()->getPluginById($plugin_id);
$this->metadata = $this->plugin->getMetadata(); $this->metadata = $this->plugin->getMetadata();
$this->screenshots = [];
if (isset($this->metadata['screenshot'])) {
$screenshots = explode('.', $this->metadata['screenshot']);
$ext = end($screenshots);
$title = str_replace('_', ' ', basename($this->metadata['screenshot'], ".{$ext}"));
$source = "{$this->plugin->getPluginURL()}/{$this->metadata['screenshot']}";
$this->screenshots[] = compact('title', 'source');
}
if (isset($this->metadata['additionalscreenshots'])) {
foreach ($this->metadata['additionalscreenshots'] as $picture) {
$pictures = explode('.', $picture);
$ext = end($pictures);
$title = str_replace('_', ' ', basename($picture, ".{$ext}"));
$source = "{$this->plugin->getPluginURL()}/{$picture}";
$this->screenshots[] = compact('title', 'source');
}
}
if (isset($this->metadata['screenshots'])) {
foreach ($this->metadata['screenshots']['pictures'] as $picture) {
$title = $picture['title'];
$source = "{$this->plugin->getPluginURL()}/{$this->metadata['screenshots']['path']}/{$picture['source']}";
$this->screenshots[] = compact('title', 'source');
}
}
PageLayout::setTitle(sprintf(_('Informationen über %s'), $this->metadata['displayname'])); PageLayout::setTitle(sprintf(_('Informationen über %s'), $this->metadata['displayname']));
} }
......
...@@ -43,15 +43,15 @@ ...@@ -43,15 +43,15 @@
<?= formatReady($plugin->getPluginDescription()) ?> <?= formatReady($plugin->getPluginDescription()) ?>
</div> </div>
</div> </div>
<? if (isset($metadata['screenshots']) && count($metadata['screenshots']['pictures'])) : ?> <? if (isset($screenshots) && count($screenshots)) : ?>
<ul class="screenshots clean"> <ul class="screenshots clean">
<? foreach ($metadata['screenshots']['pictures'] as $pictures) : ?> <? foreach ($screenshots as $screenshot) : ?>
<li> <li>
<a href="<?= $plugin->getPluginURL().$metadata['screenshots']['path'].'/'.$pictures['source'] ?>" <a href="<?= htmlReady($screenshot['source']) ?>"
data-lightbox="<?= htmlReady($metadata['displayname'] ?? $plugin->getPluginName()) ?>" data-lightbox="<?= htmlReady($metadata['displayname'] ?? $plugin->getPluginName()) ?>"
data-title="<?= htmlReady($pictures['title']) ?>"> data-title="<?= htmlReady($screenshot['title']) ?>">
<img src="<?= $plugin->getPluginURL() . ($plugin instanceof StudIPPlugin ? '/' : '') . $metadata['screenshots']['path'] . '/' . $pictures['source'] ?>" alt=""> <img src="<?= htmlReady($screenshot['source']) ?>" alt="">
<?= htmlReady($pictures['title']) ?> <?= htmlReady($screenshot['title']) ?>
</a> </a>
</li> </li>
<? endforeach ?> <? endforeach ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment