Move Sage includes from autoloader back to functions.php to fix issues including in Bedrock

This commit is contained in:
Matthew Henkler
2016-03-25 10:29:59 -05:00
parent bf31b59c6a
commit a994889f9a
3 changed files with 27 additions and 8 deletions

View File

@@ -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",

2
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bae0265fe64b728b3ad0fd3ab2ca2df0",
"hash": "7382dc6bb77190896306e1eb58b6589c",
"content-hash": "75ad99c892e1d82404c58fe3bd989585",
"packages": [
{

View File

@@ -23,6 +23,31 @@ add_action('after_switch_theme', function () {
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
*/