I want entries in a specific PlainText field for a named group to be pre-filled with random content. I am aware of the https://github.com/lukeyouell/craft-randomkeygenerator plugin and am aware that I could create my own field type, but I am intending to use jQuery to do this instead (which should be easier).
This Can a plugin add JS or CSS to the control panel? describes how to do this in Craft 2 (I assume that the code works). My equivalent in Craft3 is...
class MyPlugin extends Plugin {
if (Craft::$app->request->getIsCpRequest())
{
Craft::$app->templates->includeJs('alert("xxx")');
}
}
but $app->templates does not work. So is there a Craft3 equivalent of this line?
NB: I have already written a plugin that is adding a file volume (for encrypting files uploaded as Assets) so intend to add to that.