How to create custom DetailView

Hello i’m trying to create a custom DetailView but i’m missing something.
i create a new module csm_WarrantyCards with the module builder. Then i create a new file in:
modules/csm_WarrantyCards/views/view.detail.php like that:

I create a simple csm_WarrantyCardsViewDetail.tpl too. But the problem is that i can open anything after this modification. If i check the graphql i have this output:

{“errors”:[{“message”:“Internal server error”,“extensions”:{“category”:“internal”},“locations”:[{“line”:2,“column”:3}],“path”:[“viewDefinition”]}],“data”:{“viewDefinition”:null}}

if i change the name of the class for example in csm_WarrantyCardsViewDetailxxx everything is working again. The permission are ok. The php version is the 8.0 but i tryied with the 7.4 too

Am i the only with this problem? Can someone help me?

@Pat0

Try:

  • changing extends to ViewDetail
  • remove require_once

Hi @p.konetskiy i tryied and now i don’t have any errors, but the code I write is ignored.

am i missing something?

@Pat0

Try to write that:

...
    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('module/csm_Warranty....tpl'));
    }
    public function display($showTitle = true, $ajaxSave = false)
    {
        $this->th->ss->assign('MESSAGE','Hello world!')
        parent:display($showTitle, $ajaxSave)
    }
...

Unfortunately it’s not working, i tryied to add some “die();” but it’s seem they are ignored too.
i deleted the cache in public/legacy/cache but no changes