From c49a811fb52a12a7253b01d485088891409721f1 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 11 Nov 2020 12:19:23 +0100 Subject: [PATCH] Library: Add getters for the different asset paths --- .../Icinga/Application/Libraries/Library.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/library/Icinga/Application/Libraries/Library.php b/library/Icinga/Application/Libraries/Library.php index c21be139f..b7024c8a5 100644 --- a/library/Icinga/Application/Libraries/Library.php +++ b/library/Icinga/Application/Libraries/Library.php @@ -14,6 +14,15 @@ class Library /** @var string */ protected $path; + /** @var string */ + protected $jsAssetPath; + + /** @var string */ + protected $cssAssetPath; + + /** @var string */ + protected $staticAssetPath; + /** @var string */ protected $version; @@ -43,6 +52,39 @@ class Library return $this->path; } + /** + * Get path of this library's JS assets + * + * @return string + */ + public function getJsAssetPath() + { + $this->assets(); + return $this->jsAssetPath; + } + + /** + * Get path of this library's CSS assets + * + * @return string + */ + public function getCssAssetPath() + { + $this->assets(); + return $this->cssAssetPath; + } + + /** + * Get path of this library's static assets + * + * @return string + */ + public function getStaticAssetPath() + { + $this->assets(); + return $this->staticAssetPath; + } + /** * Get this library's name * @@ -158,6 +200,8 @@ class Library return []; } + $this->{$type . 'AssetPath'} = $dir; + return new RecursiveIteratorIterator(new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::CURRENT_AS_PATHNAME | RecursiveDirectoryIterator::SKIP_DOTS