Skip to content
Snippets Groups Projects
Commit 2a4201db authored by Bernhard Posselt's avatar Bernhard Posselt
Browse files

Merge pull request #10964 from owncloud/static-array-functions

More sugar for including lists of files in templates
parents dc99fd76 023e0669
No related branches found
No related tags found
No related merge requests found
......@@ -26,30 +26,52 @@ 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) {
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) {
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) {
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));
}
}
/**
* make OC_Helper::linkTo available as a simple function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment