OC-5883: Programatically get subject-specific info and specific PForm URL

Includes merged code from OC-5884, OC-5826, OC-5983, OC-5839, OC-6052, OC-6050, OC-5795, OC-5722.
Put in unit test