Backend Implementation (PHP)
To register new emails, developers should use the following code:
/** * Register new Elements. * * @paramobject $element_service The service responsible for registering elements * @returnvoid*/functionregister_new_element($element_service){$element_service->register_element(new\YourNewElement());}add_action('yaymail_register_elements','register_new_element');// Enqueue WordPress React scriptsfunctionenqueue_wp_react_scripts(){wp_enqueue_script('wp-react');}add_action('wp_enqueue_scripts','enqueue_wp_react_scripts');
This code attaches to the yaymail_register_elements action hook. It is used to register new email templates by passing the email instance.