diff --git a/attachments_component/site/src/Helper/AttachmentsJavascript.php b/attachments_component/site/src/Helper/AttachmentsJavascript.php
index 41411328..8a073b62 100644
--- a/attachments_component/site/src/Helper/AttachmentsJavascript.php
+++ b/attachments_component/site/src/Helper/AttachmentsJavascript.php
@@ -84,4 +84,20 @@ public static function closeModal()
myparent.location.reload();
';
}
+
+ public static function modifyLinksForDesktop(): void
+ {
+ echo '';
+ }
}
diff --git a/attachments_component/site/tmpl/attachments/default.php b/attachments_component/site/tmpl/attachments/default.php
index 4f0611ca..42d7344f 100644
--- a/attachments_component/site/tmpl/attachments/default.php
+++ b/attachments_component/site/tmpl/attachments/default.php
@@ -231,58 +231,49 @@
}
}
- $show_in_modal = (!$app->client->mobile) &&
- ($this->file_link_open_mode == 'in_a_popup') &&
+ $show_in_modal = ($this->file_link_open_mode == 'in_a_popup') &&
($attachment->file_type === "application/pdf" ||
str_starts_with($attachment->file_type, "text/") ||
str_starts_with($attachment->file_type, "image/"));
+ AttachmentsJavascript::setupModalJavascript();
+
+ $randomId = base64_encode('show' . $attachment->id . $actual_filename);
+ // Remove +,/,= from the $randomId
+ $randomId = strtr($randomId, "+/=", "AAA");
+ $modalParams['title'] = $this->escape($tooltip);
+ $modalParams['url'] = $url;
+ $modalParams['height'] = '80%';
+ $modalParams['width'] = '80%';
+ $modalParams['bodyHeight'] = '80';
+ $modalParams['modalWidth'] = '80';
+ if ($this->secure) {
+ $url .= "&popup=1";
+ }
+ $html .= LayoutHelper::render(
+ 'libraries.html.bootstrap.modal.main',
+ [
+ 'selector' => 'modal-' . $randomId,
+ 'body' => "",
+ 'params' => $modalParams
+ ]
+ );
+
if ($show_in_modal) {
- $a_class = 'modal-button';
- AttachmentsJavascript::setupModalJavascript();
-
- $randomId = base64_encode('show' . $attachment->id . $actual_filename);
- // Remove +,/,= from the $randomId
- $randomId = strtr($randomId, "+/=", "AAA");
- $modalParams['title'] = $this->escape($tooltip);
- $modalParams['url'] = $url;
- $modalParams['height'] = '80%';
- $modalParams['width'] = '80%';
- $modalParams['bodyHeight'] = '80';
- $modalParams['modalWidth'] = '80';
- if ($this->secure) {
- $url .= "&popup=1";
- }
- $html .= LayoutHelper::render(
- 'libraries.html.bootstrap.modal.main',
- [
- 'selector' => 'modal-' . $randomId,
- 'body' => "",
- 'params' => $modalParams
- ]
- );
-
- $show_link = "";
- if ($this->use_fontawesome_icons) {
- $show_link .= '';
- } else {
- $show_link .= HTMLHelper::image('com_attachments/file_icons/' . $icon, null, null, true);
- }
- $show_link .= " " . $filename . "";
+ $a_class = 'attachment modal-button';
} else {
$a_class = 'at_icon';
- $show_link = "";
- if ($this->use_fontawesome_icons) {
- $show_link .= '';
- } else {
- $show_link .= HTMLHelper::image('com_attachments/file_icons/' . $icon, null, null, true);
- }
- $show_link .= " " . $filename . "";
}
+
+ $show_link = "";
+ if ($this->use_fontawesome_icons) {
+ $show_link .= '';
+ } else {
+ $show_link .= HTMLHelper::image('com_attachments/file_icons/' . $icon, null, null, true);
+ }
+ $show_link .= " " . $filename . "";
+
$html .= $show_link;
if (($attachment->uri_type == 'url') && $this->superimpose_link_icons) {
if ($attachment->url_valid) {
@@ -535,6 +526,9 @@
// Close the HTML
$html .= "\n";
+// If attachments should be opened in a popup on desktop, modify the links
+AttachmentsJavascript::modifyLinksForDesktop();
+
if ($format != 'raw') {
$html .= "\n";
}