I have been using features to scaffold my content types. After creating one with a collection of fields, I go into the features_ui to generate the local copy of configurations, but discovered that the feature to auto-detect the dependencies aren't working in version 8.x-3.0-beta6 (Drupal core 8.1.6 via the Lightning v1.01 distro).
Steps to reproduce:
1. Create content type
2. Add a few fields
3. Navigate to features ui (enable if not initially) and create new feature
4. Select content type created in step 1
Outcome: No other checkboxes are automatically selected based on what the content type has already.
Expected: Dependencies are selected automatically.
I think this might be a regression, but wanted to flag this as it's impeding progress on creation of new configuration items.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | features_new_package_auto_detect-2778547-3.patch | 887 bytes | mpotter |
Comments
Comment #2
mpotter commentedDid some debugging and chatting with @pcho and learned more about this.
The issue is that when you click "Create new feature", it doesn't automatically pull in dependencies that are already put into suggested features. For example, when you create a content type called "MyTest" and then add fields, Features automatically adds a new non-exported package to the Features listing page called "MyTest" that contains the MyTest content type and dependencies. This is done as expected by the assignment plugins.
However, now when you click "Create new feature", the MyTest content type is available to be added to the new feature, but when selecting it, none of it's dependencies are auto-detected because they still belong to the MyTest feature.
I think this is somewhat "by design", but it's a crummy developer experience, especially developers coming from D7 Features.
So changing this to a "Feature Request" to allow config that is auto-assigned to a non-exported package to still be auto-detected and added to a new blank feature.
Comment #3
mpotter commentedOh wow. No, this was actually a bug. The Ajax callback used to auto-detect dependencies was checking for existing config in a package. But when you are on the Create New Feature page, there isn't any package yet. So it was causing a silent exception with a null object in the ajax callback.
Here is the simple patch to fix.
Comment #5
mpotter commentedCommitted to fd22277.
Comment #6
pcho commentedThe patch is verified working on my stack. The performance is a little slow, though this patch did improve speeds immensely:
https://www.drupal.org/files/issues/2765911.6.patch
That being said, there is a bit of a wait even with both patches committed, so I don't know if it would be beneficial to have a loading icon show up somewhere in the UI to signify the user that something is in play, especially if the contnet type has a ton of dependencies.
But this is a completely separate feature request (enhancement).
This fix is good! Thanks for the quick turnaround.