How to custom view.compose.php of Email module

Hi everybody

How can I override the compose view in the Email module, I am trying this:

<?php

require_once('include/MVC/View/views/view.edit.php');

class EmailsViewCompose extends ViewEdit
{
    function EmailsViewCompose()
	{
		parent::ViewEdit();
	}
    
    function preDisplay()
	{
		global $current_user;
		$id_current_user = $current_user->id;
        echo '<script type = "text/javascript" src="custom/modules/Emails/Javascript/controladorEmails.js"></script>';
        parent::preDisplay();
	}
}

?>

But the template to build the email doesn’t work, how can I load my custom javascript without affecting the emailComposer?

Thanks for your help

Best Regards

Try this in custom/modules/Emails/views/view.compose.php

<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}

require_once 'modules/Emails/views/view.compose.php';

class CustomEmailsViewCompose extends EmailsViewCompose
{
    public function preDisplay()
    {
        [...your code here...]

        parent::preDisplay();
    }
}

This is to have a class CustomEmailsViewCompose which extends class EmailsViewCompose which extends ViewEdit

Thanks for your help it works !!

1 Like