Code generation when embedding
So far so good, but what about the generated code? How are the code for the embedding and embedded plugin merged? In the embedding plugin's JS code, simply write something like this:
function printout () {
// ...
echo ("myplotfunction ([...]" + getString ("plotoptions.code.printout"); + ")\n");
// ...
}
So essentially, we are fetching the code generated by the embedded plugin just like we are fetching any other GUI setting. Here the string "plotoptions.code.printout"
can be deparsed to: “The printout section of the generated code of the element with the id
plotoptions” (plotoptions is the ID we gave for the <embed> tag above). And yes, if you want advanced control, you can even fetch the values of individual GUI elements inside the embedded plugin (but not the other way around, as the embedded plugin does not know anything about its surroundings).