Problem/Motivation
We currently don't have any mention in our docs of the config/optional directories for config for modules and profiles.
WHAHUHWHA?????
Only config/install is mentioned on
https://api.drupal.org/api/drupal/core!core.api.php/group/config_api/8
and
https://www.drupal.org/node/2120571
Proposed resolution
Add some docs to both places. Core patch and drupal.org node update.
Remaining tasks
Make a patch and get it committed.
Update the node. [Done]
User interface changes
None.
API changes
None. Just docs.
Data model changes
None.
Original issue report
I'm making an distro.
I have a block.block.views_block__comments_recent_block_1.yml
It depends on views module, comments module, and comments_recent view provided, optionally by the comments module.
My profile is failing to install because this block's dependencies are not met - the view is not present.
I discovered that any profile config which depends on optional config, needs to be placed in the profile's optional config directory.
I have no idea where is the documentation for creating d8 install profiles....
Beta phase evaluation
| Issue category | Bug because this is pretty crucial information and is not documented for developers. |
|---|---|
| Issue priority | Major because this is crucial information |
| Unfrozen changes | Unfrozen because it only changes documentation |
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | module_profile_use_of-2545958-16.patch | 2.85 KB | Anonymous (not verified) |
| #16 | interdiff-14-16.txt | 1.54 KB | Anonymous (not verified) |
| #14 | module_profile_use_of-2545958-14.patch | 2.83 KB | Anonymous (not verified) |
| #14 | interdiff-12-14.txt | 2.68 KB | Anonymous (not verified) |
| #12 | 2545958-12.patch | 2.5 KB | Anonymous (not verified) |
Comments
Comment #2
matslats commentedComment #3
matslats commentedComment #4
matslats commentedComment #5
matslats commentedComment #6
jhodgdonYeah, we don't have documentation on config/optional apparently. ?!? sigh.
Only config/install is mentioned on
https://api.drupal.org/api/drupal/core!core.api.php/group/config_api/8
and
https://www.drupal.org/node/2120571
This is a nearly critical issue and must be fixed.
Comment #7
jhodgdonSummary update
Comment #8
attiks commentedKeep in mind that optional isn't working - for the moment - for profiles, see #2513604: Create default responsive image styles
Comment #9
Anonymous (not verified) commentedHere is a start. I'm not sure what additional information we should give..
Comment #10
jhodgdonThis looks pretty good to me.... I wonder if the added paragraph should go a bit later though? It talks about dependencies, which are mentioned in the next bullet item.
Hm...
So actually, looking at
https://api.drupal.org/api/drupal/core!core.api.php/group/config_api/8
that bullet item that says:
is under Configuration Entities. That doesn't seem like the right place to add another bullet about config/optional.
I think what we should do instead is:
a) In the Configuration YAML Files section, add information about the config/install directory to the bullet item about "Defining the default configuration for a module". Right now it doesn't say there where to put these config items at all and it should.
b) Add a separate bullet item just after that about optional configuration in config/optional right after that (rather than blending it in as is done in the current patch). Mention that this is for configuration that has dependencies that are not explicit dependencies of your module, and that this config will be loaded when dependencies are met. [Actually... So if module A has config that depends on module B in its config/optional, and you install A and then later install B, will Drupal go back and find the B-dependent config in A's config/optional and install it then?] You might also reference the config entities section here, because that is where dependencies are mentioned.
c) Change the existing bullet item in the Config Entities section to say something like "Your module can provide default/optional configuration entities in YAML files, as described in @sec ..." and have that not mention the config/install directory explicitly.
Does that make sense?
Comment #11
Anonymous (not verified) commentedYes, it's way clearer. No interdiff since everything changed around.
Yes. After installing all modules, the installation procedure goes through everything again and installs all optional config where possible.
Comment #12
Anonymous (not verified) commentedFormatting fix.
Comment #13
jhodgdonLooking good! A few thoughts [note: reviewed #11 patch]:
Should we also mention that themes and profiles can have config/install?
I think themes can also have config/optional (and maybe profiles if that other issue gets fixed)?
Slight clarification on this sentence:
These configuration items have dependencies that are not explicit dependencies of the module, so they are only installed if all dependencies are met.
Maybe add after this:
If module B is installed sometime later, then module A's config/optional directory will be scanned at that time for newly met dependencies, and the configuration will be installed at that time.
(or something like that...)
I guess this will make the section a bit redundant? Maybe can be written to make it less redundant? But I think that point about returning later when B is installed is important to mention.
Comment #14
Anonymous (not verified) commentedI find myself switching and altering sentences for some time now. It's time to propose something again..
Comment #15
jhodgdonLooks great!
Just one small nitpick:
Needs comma after "theme" (we use serial commas by convention in the Drupal project).
And a suggestion for maybe slightly better wording:
These first two sentences are a bit choppy. Maybe we could say:
Defining the default configuration for an extension (module, theme, or profile), which is imported to the active storage when the extension if enabled.
Comment #16
Anonymous (not verified) commentedHere you go!
Comment #17
jhodgdonLooks good to me! Thanks!
Someone also needs to add similar information to
https://www.drupal.org/node/2120571
Want to do that too?
Comment #18
Anonymous (not verified) commentedYeah, I'll have a look at that.
edit: added a paragraph on optional config and did some rewording elsewhere
Comment #19
jhodgdonhttps://www.drupal.org/node/2120571 looks good to me, thanks! So all that remains is to get this patch committed.
Comment #21
webchickAwesome, thanks both for catching this, and for working on these important docs that were missing!
Committed and pushed to 8.0.x. Thanks!