summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-09 15:47:42 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-09 15:47:42 +0200
commit023e066971429f0490213f2dc3f443700a960149 (patch)
tree07dd59302b4ddfc4e645f1789617f1af6151e6f2 /lib
parentdc99fd768ac99c380f1110c7bd4dd84d03256cd8 (diff)
downloadnextcloud-server-023e066971429f0490213f2dc3f443700a960149.tar.gz
nextcloud-server-023e066971429f0490213f2dc3f443700a960149.zip
more sugar for including lists of templates
Diffstat (limited to 'lib')
-rw-r--r--lib/private/template/functions.php36
1 files changed, 29 insertions, 7 deletions
diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index 05467e61185..cbe751e59b5 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -26,29 +26,51 @@ function print_unescaped($string) {
/**
* Shortcut for adding scripts to a page
* @param string $app the appname
- * @param string $file the filename
+ * @param string|string[] $file the filename,
+ * if an array is given it will add all scripts
*/
function script($app, $file) {
- OC_Util::addScript($app, $file);
+ if(is_array($file)) {
+ foreach($file as $f) {
+ OC_Util::addScript($app, $f);
+ }
+ } else {
+ OC_Util::addScript($app, $file);
+ }
}
/**
* Shortcut for adding styles to a page
* @param string $app the appname
- * @param string $file the filename
+ * @param string|string[] $file the filename,
+ * if an array is given it will add all styles
*/
function style($app, $file) {
- OC_Util::addStyle($app, $file);
+ if(is_array($file)) {
+ foreach($file as $f) {
+ OC_Util::addStyle($app, $f);
+ }
+ } else {
+ OC_Util::addStyle($app, $file);
+ }
}
/**
* Shortcut for HTML imports
* @param string $app the appname
- * @param string $file the path relative to the app's component folder
+ * @param string|string[] $file the path relative to the app's component folder,
+ * if an array is given it will add all components
*/
function component($app, $file) {
- $url = link_to($app, 'component/' . $file . '.html');
- OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+ if(is_array($file)) {
+ foreach($file as $f) {
+ $url = link_to($app, 'component/' . $f . '.html');
+ OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+ }
+ } else {
+ $url = link_to($app, 'component/' . $file . '.html');
+ OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+ }
}
/**