Skip to content
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
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

Classes to use Acorn with child themes:

- WP like inheritance for config files; child config will override parent config
- No directory scans, everything is config based
- WP like inheritance for config files; child config will override parent configuration.
- No directory scans, everything is configuration based.

## Requirements

Expand Down Expand Up @@ -56,7 +56,7 @@ To install this package using Composer, follow these steps:
*/
```

2. Add PSR-4 autoloading for your child theme to your composer.json:
2. Add PSR-4 autoloading for your child theme to your (root) `composer.json`:

```diff
"autoload": {
Expand All @@ -67,6 +67,8 @@ To install this package using Composer, follow these steps:
},
```

Remove the autoloading from your theme `composer.json` if applicable.

3. In `sage/config/app.php` change:

```diff
Expand All @@ -76,17 +78,11 @@ To install this package using Composer, follow these steps:

4. In `sage/functions.php` change:

```diff

-\Roots\Bootloader()->boot();
+define('ACORN_BASEPATH', __DIR__);
+$bootloader = \Roots\bootloader();
+$bootloader->getApplication()->bind(
+ \Roots\Acorn\Bootstrap\LoadConfiguration::class,
+ \Yard\SageChildThemeSupport\Bootstrap\LoadConfiguration::class
+);
+$bootloader->boot();
```
```diff
-\Roots\bootloader()->boot();
+define('ACORN_BASEPATH', __DIR__);
+\Yard\SageChildThemeSupport\bootloader()->boot();
```

5. Add view composers to `config/view.php`

Expand All @@ -99,5 +95,21 @@ To install this package using Composer, follow these steps:
+ ],
```

6. Add any custom console commands to `config/console.php`:

```diff
+ 'commands => [
+ 'test' => App\Console\Commands\Test::class,
+ ],
```

> [!IMPORTANT]
> After this change, View Composers in the app/View/Composers directory will no longer be loaded automatically. To ensure they are registered, you have to configure them manually.
> After this change:
>
> - View Composers in the app/View/Composers directory will no longer be loaded automatically. To ensure they are registered, you have to configure them manually.
> - Console Commands in the app/Console/Commands directory will no longer be loaded automatically. To ensure they are register, you have to configure them manually.

## Usage

To override configuration for your child theme add the relevant files to the `child-theme/config` directory.
The configuration for the child theme is merged with the parent configuration where child theme configuration takes precedence. To unset a configuration option from the parent theme in the child theme you can pass an empty array for that configuration option.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
},
"require-dev": {
"larastan/larastan": "^2.9",
"orchestra/testbench": "^8.31",
"szepeviktor/phpstan-wordpress": "^1.3",
"yard/php-cs-fixer-rules": "^1.0"
},
"autoload": {
"psr-4": {
"Yard\\SageChildThemeSupport\\": "src/"
}
},
"files": [
"src/helpers.php"
]
},
"scripts": {
"post-autoload-dump": [
Expand Down
Loading