UNSOLVED Inserting additional template data into composer template
Hi, I am customizing the default composer.
To have a better understanding of how this templating system works, I am trying to add a new variable, similar to
isTopicOrMainfor a conditonal in the composer.tpl.
I noticed that
isTopicOrMainis defined in 2 files
library.js, in line:197, inside object
composer.jsin line:457, inside object
when are each definition used?
From the look it seems one is for server side and the other one is client side? Are the two object synchronized at some point then?
@erichbb direct links to the code:
Yes one is server side and one is client side.
dogs last edited by dogs
@erichbb I think this might help you:
Of course your fields don't need to be hidden. But with this example and editing composer you should be able to add fields to composer as default. Hidden as well as visible.
when does that server side code (
Specifically, I know it is binded to the hook
filter:composer.buildmethod I do not know when does that hook fires.
I have put some
console.log()statements inside the
filterComposerBuildmethod, but I can't find the output from either brower's debug console or nodebb backend terminal (running in
And from the name of the method, it seems it is only executed once when the composer initializing?
Which hook should I bind to if I want react to interaction? (Or are hooks only relevant for server side stuff?)
Can you point me to some materials explaining how the frontend and hooks interact?
I don't complete follows their discussion on
data.submittedDataand is still confused about which variable is the post data stored in and which hooks are involved when it is passed around.
Also found this, maybe relevant
Difference between templateValues and templateData