From f2bbd54ef2be0f4fbaff81fcdc04e62a2227bb4c Mon Sep 17 00:00:00 2001 From: Andreas Hennings Date: Thu, 14 Nov 2024 01:17:33 +0100 Subject: [PATCH] Issue #56: Support different MIME types. --- src/Cool/CoolRequest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Cool/CoolRequest.php b/src/Cool/CoolRequest.php index 19c2e7ff..d3529013 100644 --- a/src/Cool/CoolRequest.php +++ b/src/Cool/CoolRequest.php @@ -45,13 +45,17 @@ public function __construct( /** * Gets the URL for the WOPI client. * + * @param string $mimetype + * Mime type for which to get the WOPI client url. + * This refers to config entries in the discovery.xml file. + * * @return string * The WOPI client url, or NULL on failure. * * @throws \Drupal\collabora_online\Exception\CoolRequestException * The client url cannot be retrieved. */ - public function getWopiClientURL(): string { + public function getWopiClientURL(string $mimetype = 'text/plain'): string { $discovery = $this->getDiscoveryXml(); $discovery_parsed = simplexml_load_string($discovery); @@ -62,7 +66,7 @@ public function getWopiClientURL(): string { ); } - $wopi_src = $this->getWopiSrcUrl($discovery_parsed, 'text/plain'); + $wopi_src = $this->getWopiSrcUrl($discovery_parsed, $mimetype); return $wopi_src; }