Skip to content

Commit 9d78833

Browse files
committed
refactoring and fix scss composition when snippet file cannot be found
1 parent 1b9cd7e commit 9d78833

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

classes/snippets.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static function get_snippet_scss($path, $source) {
8585
$file = self::get_snippet_file($path, $source);
8686

8787
if (is_null($file)) {
88-
return null;
88+
return '';
8989
}
9090

9191
$scss = file_get_contents( $file, false, null, 0);

lib.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
define('THEME_BOOST_UNION_SETTING_EXTSCSSSOURCE_DOWNLOAD', 1);
129129
define('THEME_BOOST_UNION_SETTING_EXTSCSSSOURCE_GITHUB', 2);
130130

131+
use theme_boost_union\snippets;
132+
131133
/**
132134
* Returns the main SCSS content.
133135
*
@@ -159,8 +161,8 @@ function theme_boost_union_get_main_scss_content($theme) {
159161
// Thus, we sadly have to get and include the external Post SCSS here already.
160162
$scss .= theme_boost_union_get_external_scss('post');
161163

162-
// Setting: CSS Snippets.
163-
$scss .= theme_boost_union_get_snippets_scss();
164+
// Include SCSS of enabled Style snippets.
165+
$scss .= snippets::get_enabled_snippet_scss();
164166

165167
return $scss;
166168
}

locallib.php

-11
Original file line numberDiff line numberDiff line change
@@ -2222,17 +2222,6 @@ function theme_boost_union_get_external_scss($type) {
22222222
return $extscss;
22232223
}
22242224

2225-
/**
2226-
* Gets and returns the SCSS based on the enabled CSS snippets.
2227-
*
2228-
* @return string The (S)CSS strings content.
2229-
*/
2230-
function theme_boost_union_get_snippets_scss() {
2231-
$snippetsscss = snippets::get_enabled_snippet_scss();
2232-
2233-
return $snippetsscss;
2234-
}
2235-
22362225
/**
22372226
* Helper function which wxtracts and returns the pluginname for the given callback name.
22382227
* This function simply differentiates between real plugins and core components.

0 commit comments

Comments
 (0)