Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoloader load order issue when including Sage 9 via composer.json in Bedrock #1628

Merged
merged 1 commit into from Apr 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@
"autoload": {
"psr-4": {
"Roots\\Sage\\": "src/lib/Sage/"
},
"files": [
"src/helpers.php",
"src/setup.php",
"src/filters.php",
"src/admin.php"
]
}
},
"require": {
"php": ">=5.5.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@
basename($stylesheet) == 'templates' || update_option('stylesheet', $stylesheet . '/templates');
});

/**
* Sage includes
*
* The $sage_includes array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*
* Please note that missing files will produce a fatal error.
*
* @link https://github.com/roots/sage/pull/1042
*/
$sage_includes = [
'src/helpers.php', // Helper functions
'src/setup.php', // Theme setup
'src/filters.php', // Filters
'src/admin.php' // Admin
];

foreach ($sage_includes as $file) {
if (!$filepath = locate_template($file)) {
trigger_error(sprintf(__('Error locating %s for inclusion', 'sage'), $file), E_USER_ERROR);
}
require_once $filepath;
}
unset($file, $filepath);

/**
* Require composer autoloader
*/
Expand Down