Skip to content

Commit 5d07eba

Browse files
committed
Sage path support
1 parent e6b278c commit 5d07eba

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

intervention.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,29 @@ function get()
3636
{
3737
$theme = get_stylesheet_directory();
3838

39-
$default = file_exists($theme . '/config/') ?
39+
/**
40+
* Sage once included `style.css`under directory resources
41+
* which makes `$theme` incorrectly point to `resources/config`
42+
* resulting in the config file not being found. Searching
43+
* for `resources` and changing to the parent directory fixes
44+
* the issue
45+
*/
46+
$matchpos = strpos($theme, '/resources');
47+
$match = $matchpos && strpos($theme, 'resources') + strlen('resources') === strlen($theme);
48+
49+
if ($match) {
50+
$theme = dirname(get_stylesheet_directory());
51+
}
52+
53+
$config = file_exists($theme . '/config/') ?
4054
$theme . '/config/intervention.php' :
4155
$theme . '/intervention.php';
4256

57+
/*
4358
$config = has_filter('sober/intervention/return') ?
4459
apply_filters('sober/intervention/return', rtrim($default)) :
4560
$default;
61+
*/
4662

4763
if (!file_exists($config)) {
4864
return;

0 commit comments

Comments
 (0)