Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to explore the feedback provided in #125 for plugins wanting to participate in "post" liberation by not having to specify the same code twice.
Problem:
During liberation hook
Post liberation hook
Suggested solution as it was discussed on call was to: Just trigger the
data_liberated_X
hook again in post liberation handling. The plugin can indicate when it wants to do that bydo_action( 'do_data_liberation', 'product' );
and we would fire thedata_liberated_product
hook to which the plugin is already attached. This PR has the code for it, but the problem with this approach is, there could be other plugins still attached todata_liberated_product
and we don't want all of them to be executing, only the one triggering it. In order to achieve that, we would have to hack global state, which is an anti-pattern I would like to avoid.So, how about the solution to be just this?
We ask the developers, to define a function to handle the subject type they are interested in:
and update docs to
During liberation hook
Post liberation hook
Pretty simple solution! Thoughts?