Merge pull request #8137 from christopherdarling/patch-11

DOCS fix 4.0.0 changelog example code for findThemedResource
This commit is contained in:
Daniel Hensby 2018-06-05 17:18:47 +01:00 committed by GitHub
commit 73c6c61ff7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -484,6 +484,7 @@ Usage with custom logic:
```diff
+use SilverStripe\Core\Manifest\ModuleLoader;
+use SilverStripe\View\ThemeResourceLoader;
+use SilverStripe\View\SSViewer;
-$moduleFilePath = FRAMEWORK_DIR . '/MyFile.php';
+$moduleFilePath = ModuleLoader::getModule('silverstripe/framework')->getResource('MyFile.php')->getRelativePath();
@ -495,7 +496,8 @@ Usage with custom logic:
+$mysiteFilePath = ModuleLoader::getModule('mysite')->getResource('css/styles.css')->getRelativePath();
-$themesFilePath = SSViewer::get_theme_folder() . '/css/styles.css';
+$themesFilePath = ThemeResourceLoader::inst()->findThemedResource('css/styles.css');
+$themes = SSViewer::get_themes();
+$themesFilePath = ThemeResourceLoader::inst()->findThemedResource('css/styles.css', $themes);
-$themeFolderPath = THEMES_DIR . '/simple';
+$themeFolderPath = ThemeResourceLoader::inst()->getPath('simple');