Add plugin hook for adding vars in vars.js

Also improve plugin_hook to handle no returned values