Trying to add TemplateDef information to templates at runtime. refs #500