[ticket/12066] Form renderer and templates

Most code adapted from Symfony Framework Bundle.

PHPBB3-12066