Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel authored Jun 20, 2022
1 parent f998366 commit f74fdd5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,35 @@ Additionally, a "global" config that will apply everywhere else is added using t
`volume:{handle}` - Apply for assets in a particular volume
`users` - Apply for user account edit pages

#### Config context inheritance

‼️ MatrixMate config contexts are **not** recursively merged – unlike, for example, Craft's multi-environment configs. This means that if you have a global config context (i.e. `*`) and a context targeting, for example, a specific section (e.g. `'section:news'`), the settings for the global config are **not** inherited by that `'section:news'` context. Essentially, you start fresh for every context. This is not a bug, but a feature!

...in cases where you'd prefer that config contexts were merged, you can work around this behavior by adding a bit of PHP logic to the config file:

```php
<?php

$globalConfig = [
'groups' => [
...
],
];

return [
'fields' => [
'matrixFieldHandle' => [
'*' => $globalConfig,
'section:news,section:blog' => array_merge_recursive($globalConfig, [
'groups' => [
...
],
]),
],
],
];
```

### Configuration settings

The below settings apply to a Matrix field configuration, e.g.
Expand Down

0 comments on commit f74fdd5

Please sign in to comment.