In SugarCRM it is possible to customize the way EditView template it’s displayed. In this article we explore how can add a header or a footer to the view.

What must be done?

In your <module_name> folder you have to edit editviewdefs.php from the metadata directory and adding this lines of code:

'form' => array(
      'footerTpl'=>'modules/lqd_Invoices/tpls/EditViewFooter.tpl',
      'headerTpl'=>'modules/lqd_Invoices/tpls/EditViewHeader.tpl',
      ),

to the $viewdefs array.

The fragment of your code must looks like:

$viewdefs [$module_name] =
array (
  'EditView' =>
  array (
    'templateMeta' =>
    array (
      'maxColumns' => '2',
      'widths' =>
      array (
        0 => array ('label' => '10', 'field' => '30'),
        1 => array ('label' => '10', 'field' => '30'),
      ),
      'form' => array(
 'footerTpl'=>'modules/lqd_Invoices/tpls/EditViewFooter.tpl',
 'headerTpl'=>'modules/lqd_Invoices/tpls/EditViewHeader.tpl',
 ),
      'useTabs' => false,
      'syncDetailEditViews' => true,
    )

Then you have to create in <module_name>/tpl/ the two files: EditViewFooter.tpl and EditViewHeader.tpl .

You can add your custom code here now, but don’t forget to include the generic header and footer tlp.

Your code must look like:

EditViewHeader.tpl
{$my_widget_for_header}
bla bla bla
{{include file='include/EditView/header.tpl'}}</pre>
EditViewFooter.tpl
{$my_widget_for_footer}
bla bla bla
{{include file='include/EditView/footer.tpl'}}

Don’t forget to do a “Quick Rebuild and Repair” from Administration.

That’s all :)