Skip to content

Commit

Permalink
Issue CollaboraOnline#56: Support different MIME types.
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote committed Nov 14, 2024
1 parent d5b03b5 commit f2bbd54
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Cool/CoolRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit f2bbd54

Please sign in to comment.