summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/frontenddefinitiontrait.php
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2016-02-08 13:16:00 +0000
committerRobin McCorkell <robin@mccorkell.me.uk>2016-05-03 11:30:02 +0100
commitde98a6e54cd2d732e0b7c1297e8da43e53bb97c7 (patch)
treed181a50261fea23ee4366bb70da0f6d02c03d834 /apps/files_external/lib/frontenddefinitiontrait.php
parent06293783e0d291a5595b55a3268d8bc0704277db (diff)
downloadnextcloud-server-de98a6e54cd2d732e0b7c1297e8da43e53bb97c7.tar.gz
nextcloud-server-de98a6e54cd2d732e0b7c1297e8da43e53bb97c7.zip
Allow multiple custom JS files
Diffstat (limited to 'apps/files_external/lib/frontenddefinitiontrait.php')
-rw-r--r--apps/files_external/lib/frontenddefinitiontrait.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/apps/files_external/lib/frontenddefinitiontrait.php b/apps/files_external/lib/frontenddefinitiontrait.php
index 9f2b7c40f7f..ccc2a75fd1b 100644
--- a/apps/files_external/lib/frontenddefinitiontrait.php
+++ b/apps/files_external/lib/frontenddefinitiontrait.php
@@ -36,8 +36,8 @@ trait FrontendDefinitionTrait {
/** @var DefinitionParameter[] parameters for mechanism */
private $parameters = [];
- /** @var string|null custom JS */
- private $customJs = null;
+ /** @var string[] custom JS */
+ private $customJs = [];
/**
* @return string
@@ -92,7 +92,7 @@ trait FrontendDefinitionTrait {
}
/**
- * @return string|null
+ * @return string[]
*/
public function getCustomJs() {
return $this->customJs;
@@ -102,8 +102,18 @@ trait FrontendDefinitionTrait {
* @param string $custom
* @return self
*/
+ public function addCustomJs($custom) {
+ $this->customJs[] = $custom;
+ return $this;
+ }
+
+ /**
+ * @param string $custom
+ * @return self
+ * @deprecated 9.1.0, use addCustomJs() instead
+ */
public function setCustomJs($custom) {
- $this->customJs = $custom;
+ $this->customJs = [$custom];
return $this;
}
@@ -121,10 +131,8 @@ trait FrontendDefinitionTrait {
$data = [
'name' => $this->getText(),
'configuration' => $configuration,
+ 'custom' => $this->getCustomJs(),
];
- if (isset($this->customJs)) {
- $data['custom'] = $this->getCustomJs();
- }
return $data;
}