Modify Subpanel listview template?

Hi

I wonder if there is a possibility to modify basic template for a subpanel listview?

As to the main listview template, I managed to changed it by defining class extending ViewList and defining function listViewProcess, where I replace the basic template with mine, line this:

$this->lv->setup($this->seed, ‘custom/modules/MyModuleAAA/ListView/MyListViewGeneric.tpl’, $this->where, $this->params);

The situation is records of MyModuleAAA are linked to another module BBB
And every record of BBB has list of linked items from MyModuleAAA.

When I open this item of BBB, I need to see the subpanel designed the same way as for listview of MyModuleAAA

The issue here is that the hooks do not help, as I need to modify the template (!) - my modification of the template set different css-classes for columns, which I cannot do easily with hooks

I googled it three times, but same answers all the times that do not help me :))

Is there a regular way to set up the subpanel list view template for a particular subpanel in a particular module?

Thanks in advance!

p.s. example why I need it (very simplified example, the life is not that straightforward :slight_smile: ):

  • I have a main module with countries list
  • I have a list of services and related prices we deliver to this country (services and prices differ)
  • the lines are actually organized in different types: headers and price-lines (for easy understanding)
  • and every line type has its visual css-style (headers are bold and BIG, and regular lines are normal and have indents)

And I need the pricelist to be displayed as much as user friendly to avoid user mistakes
That’s the reason for my question…

Thanks again.

Vlad

Have a look at the modules/Campaigns/action_file_map.php and modules/Campaigns/SubPanelViewer.php. Copy these files into your module and then replace the paths inside these file to match your new module.

This will allow you to change the $subpanel_object->setTemplateFile(‘include/SubPanel/tpls/SubPanelDynamic.tpl’) line; to use your custom template.

1 Like

If you check your AAA module, you will have a relate field for module BBB and a subpanel setup defined for the relate field in location custom/Extension/modules/AAA/Layoutdefs/some_name.php

Here you will have the subpanel definition for your BBB module. you can see the definition as

$layout_defs[‘AAA’][‘subpanel_setup’][‘bbb’] = array(…)

The subpanel name defined in the above array is the file that will exist in BBB module. if the above array has value subpanel_name= default, then this means get the Fields Layout for BBB subpanel from the file located at modules/bbb/metadata/subpanels/default.php

So if you want to have a different fields and customised look for your BBB subpanel in module AAA, you can create another subpanel in module BBB and call that file. For reference check the files for Calls module located inside folder modules/Calls/metadata/subpanels/

Thank you all!
I finally managed to do it by changing \include\SubPanel\SubPanelDynamic.html file

Vlad

Hello,

I would like to completely change the template of the documents subpanel for one specific relationship or for all relationships.

I don’t understand how to implement the Opportunity case for other subpanels.

Can you detail the step-by-step to make the change ?

Very appreciated.

Hey djsamson,
Can we extend modules/Accounts/SubPanelViewer.php?