I'm wrestling with where and how to best make modifications to the CiviMail new mailing form, built with Angular. There are several other questions addressing this in part, but none address my needs completely.
The customization is pretty simple: include the logged in user's email as an option in the From Address selector and set it as the default.
What I've found is that:
1) I can't simply modify the from address list using the optionValues() hook. There are some oddities with from_email_addresses passed to that hook -- not all of the values are passed for modification. And because the select2 widget in the angular form is set to filter on is_active, any values I add via the hook are ignored (the hook only let's me work with the basic option list; I have no access to other record metadata).
2) Even if I use a php override of the CRM/Mailing/Info.php file and alter the from address values passed to angular, the default value is being set in some mystery way that I've not been able to find. Altering the is_default value and weight so that my desired option is the default has no impact.
3) In general, it seems very difficult to target angular forms via a hook in order to inject js. Maybe I'm missing something obvious, but the pageRun() hook doesn't seem to give me enough to be able to condition the injection of js adequately.
Any tips would be much appreciated.