I learned that in the up coming version (6.3), there will be a way of generating computed fields that have access to the fields of a related module.
If this is the case, then one option will be to create computed fields that reference the Account fields and then add a panel to Contact DetailView with the referenced Account fields.
Though, my original hunch proved to be doable as well and not as hacky as I had assumed at first:
<?php
require_once('include/MVC/View/views/view.detail.php');
class ContactsViewDetail extends ViewDetail {
function ContactsViewDetail() {
parent::ViewDetail();
}
function preDisplay(){
parent::preDisplay();
// Configuration to display All account info
$this->dv2 = new DetailView2();
$this->dv2->ss =& $this->dv->ss;
$this->bean2 = new Account();
$this->bean2->retrieve($this->bean->account_id);
$accountMetadataFile = 'custom/modules/Accounts/metadata/detailviewdefs.php';
$accountTemplate = 'custom/modules/Accounts/tpls/AccountsDetailView.tpl';
$this->dv2->setup('Accounts', $this->bean2, $accountMetadataFile, $accountTemplate);
}
function display(){
parent::display();
// Display Accounts information.
$this->dv2->process();
echo $this->dv2->display();
}
}
?>
In summary
- Override the detail view.
- Add a new display to the current View.
- Add a new bean (module) to the View.
- Process the display with the new bean.
- Echo the display.