Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - content types hooks/filters #81

Open
grzegorzbialy opened this issue Jan 12, 2022 · 1 comment
Open

Question - content types hooks/filters #81

grzegorzbialy opened this issue Jan 12, 2022 · 1 comment
Labels
enhancement New feature or request planned

Comments

@grzegorzbialy
Copy link
Contributor

Hi,

We're looking into integrating Burdy into our agency flow. So far it seems very promising but I check docs and code and cannot find any way to programatically modify content type (eg. page content) before or after create/save. I am thinking about some hooks (lifecycle in Strapi) or filter like page/preSave. For example I have some fields which should be autofilled based on other fields.
Also, I would like to run some additional code after publish - is there a filter for this?
Can you point me into the right direction or share your ideas for these scenarios?

Thanks!
Keep up the good work. :)

@grzegorzbialy grzegorzbialy changed the title Question - content types hooks Question - content types hooks/filters Jan 12, 2022
@stefan-burdy
Copy link
Contributor

Hi @grzegorzbialy.

Thank you for using Burdy! This is something that we indeed plan to add to the project and it's in our current roadmap. The great thing about the hook integration is their flexibility and also, they can be added anywhere in the code. It's not currently a high priority in our list, but in one of the next iterations, we plan to add wrappers for each API call to include hooks in relevant places.

For example, if you take a look at the post controller .post('/posts'), we will add a hook that will allow you to completely override the behavior:

const post = await Hooks.applyFilter('posts/preSave', postObj, req); // post.controller.ts:228

This will allow you to completely change the postObj depending on some of your parameters. As an example req object currently contains the user, meaning that you would be able to add additional data (or mutations), perform some other saves, trigger actions, etc.

@stefan-burdy stefan-burdy added enhancement New feature or request planned labels Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

2 participants