Comments

Cauliflower’s picture

Status: Active » Needs review
StatusFileSize
new3.26 KB

See patch attached to this comment.

Pete B’s picture

I like this, but I also want to react on other features changing state. This is so we can easily implement some site-wide hooks before and after ANY feature is reverted.

I'll upload an altered patch.

Pete B’s picture

hefox’s picture

Title: Invoke pre and post hooks where ALL components have been enabled » Invoke pre and post hooks when ALL components have been enabled
Status: Needs review » Needs work

changing how a hook function (adding the null version of pre hook) is likely breaking api. probably better for a new hook.

Assume that was a typo in title

das-peter’s picture

Status: Needs work » Needs review
StatusFileSize
new2.08 KB

Coming from here #2241979: Add a way to prevent exportable rebuild on cron run I've built another approach.
I'm not sure if it's necessary to introduce a hook for every operation.
Attached patch uses another approach by introduce a "restore" specific hook that passes on the chosen operation and the items.

As a sidenote to #1844566-3: Invoke pre and post hooks when ALL components have been enabled what's the great benefit of having module_invoke($module_name, $pre_hook, null);?
I think module_invoke_all($restore_hook . '_before', $items); would be sufficient to achieve whatever's possible with the other hook too. Of course one would have to iterate over the items / components list on it's own but the performance drawback is not that huge and it's not that those operations are end user runtime tasks that need to be lightening fast.

fago’s picture

I'd agree with #5 that a single hook is sufficient.

I've reviewed #5 and it looks good to me. I think it's generally a reasonable addition, but moreover the introduction of this hook would allow entity API to integrate with features for rebuilding its default exportables in the database, see #2241979: Add a way to prevent exportable rebuild on cron run. So +1 on adding this.

Pete B’s picture

Status: Needs review » Reviewed & tested by the community

I'm happy with #5, which would solve my use-case. I'd love to see this released now that it has had a few eyes on it.

hefox’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.