Create custom fields in composer
-
Hey,
How can I listen to a hook just before a composer is open.
I want to create a plugin that add custom fields to the composer (and post) based on the category. So I need to listen to a hook that can give me the category id as I open a composer to create/edit a post.
Regards,
-
@Ali-Hussain hello there
You'll want to listen to one of the client-side hooks fired by the composer-default plugin.
For example,
filter:composer.create
is fired right before the composer template is parsed.import on from 'hooks'; on('filter:composer.create', ({ postData, createData }) => { // change things here });
Look inside the file
static/lib/composer.js
innodebb-plugin-composer-default
to see other hooks fired by the composer plugin. -
I have tried filter:composer.create and filter:composer.build and both are not firing, the only filter hook that is firing for me is filter:composer.formatting but that does not have the correct data i need (for example the catogory, etc)
I am using nodebb v3.0
thx for your help
-
Hi @Ali-Hussain ,
Did you ever figure this out?
I am trying to do something similar by adding a custom field to the post object based on a button I've added to the composer.