Let's say I have a form from channel "contact_us" and it is submitted through template "index/contactus". How can I use the "channel_form_submit_entry_end" hook to collect the data and template put it together and have it ready to be sent for an email? Running EE5.
Just in case someone else is looking for the answer: If after your extension is called you can rebuild the template using the following code
function your_function($obj){ $template_group = "template_group_name"; \\(string) $template = "template_name"; \\(string) ee()->uri->page_query_string = $obj->entry('entry_id');\\assign your own entry_id (int) ee()->load->library('template', NULL, 'TMPL'); ee()->TMPL->fetch_and_parse($template_group, $template, FALSE); $rendered = ee()->TMPL->parse_globals(ee()->TMPL->final_template); echo $rendered; }
Of course you can display it or set values how ever you want.