Modify one DetailView template for just one Module

I would like the opinion and comments from fellow Developers as to how they go about modifying any template but in this case just DetailView.tpl, for just one Module.

Hi Mark,

We have a custom TPL for Contacts DetailView, we did it like this:

Create a file in custom/modules/Contacts/view.detail.php

In this file you should have you custom class and should re-write the preDisplay() method:


class CustomContactsViewDetail extends ViewDetail
{
    public function preDisplay()
    {
        $metadataFile = $this->getMetaDataFile();
        $this->dv = new DetailView2();
        $this->dv->ss =&  $this->ss;
        $this->dv->setup(
            $this->module,
            $this->bean,
            $metadataFile,
            get_custom_file_if_exists('modules/Contacts/views/DetailView.tpl')
        );

        $this->manage_template_handler();
        $this->process_fields_ACL();
    }

Hope this helps!

1 Like