Problem
In #1806178: Remove code duplication for hook_config_import_*() implementations of config entities the hook_config_import_CRUD() hooks were removed in favor of class methods on Config Entities. This was a positive change as it reduced a lot of code duplication between the various Config Entity implementations. Unfortunately, as a side effect, only Config Entities can respond to import actions with custom code. There is no way for standard settings files to react with their own custom functionality. While there is currently no implementation that does this in core currently, it is something we are exploring as a part of #1553358: Figure out a new implementation for url aliases, and it should also exist for contrib to use.

Resolution
Restore hook_config_import_CRUD() in addition to the current Config Entity methods.

Patch to follow.

Files: 
CommentFileSizeAuthor
#8 drupal8.config-import.8.patch6.71 KBsun
FAILED: [[SimpleTest]]: [MySQL] 49,583 pass(es), 1 fail(s), and 2 exception(s). View
#6 1886478-import-hooks-6.patch6.45 KBheyrocker
FAILED: [[SimpleTest]]: [MySQL] 49,061 pass(es), 2 fail(s), and 37,338 exception(s). View
#2 1886478-import-hooks-1.patch6.54 KBheyrocker
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/includes/config.inc. View

Comments

heyrocker’s picture

Issue tags: +Configuration system
heyrocker’s picture

Status: Active » Needs review
FileSize
6.54 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/includes/config.inc. View

Here's a patch, its kind of ugly though. XJM mentioned in IRC that there have been a lot of issues floating around config_import_invoke_owner() and that maybe we should consider rethinking this functionality. I'm all for that, I just don't have any big ideas right at the moment.

We will need tests specifically for both types of import as well.

xjm’s picture

Those issues (off the top of my head) are:

Edit: In each issue, the part of the issue that pertains to config_import_invoke_owner() has seemed off somehow, but like @heyrocker I'm not quite sure what or how we should change it.

Status: Needs review » Needs work

The last submitted patch, 1886478-import-hooks-1.patch, failed testing.

chx’s picture

heyrocker’s picture

Status: Needs work » Needs review
FileSize
6.45 KB
FAILED: [[SimpleTest]]: [MySQL] 49,061 pass(es), 2 fail(s), and 37,338 exception(s). View

I know I checked that locally. *grumble*

Status: Needs review » Needs work

The last submitted patch, 1886478-import-hooks-6.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
6.71 KB
FAILED: [[SimpleTest]]: [MySQL] 49,583 pass(es), 1 fail(s), and 2 exception(s). View

This should fix the failures. Also adjusted the comments a bit, and renamed the tracking variable to $handled_by_api.

Status: Needs review » Needs work

The last submitted patch, drupal8.config-import.8.patch, failed testing.

heyrocker’s picture

Status: Needs work » Closed (duplicate)