$this->assign('displayName', $displayName);
$this->set('contactType', $contactType);
- $this->set('contactSubtype', $contactSubtype);
+
+ // note: there could still be multiple subtypes. We just trimming the outer separator.
+ $this->set('contactSubtype', trim($contactSubtype, CRM_Core_DAO::VALUE_SEPARATOR));
// add to recently viewed block
$isDeleted = (bool) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'is_deleted');
function getTemplateFileName() {
if ($this->_contactId) {
- $csType = $this->get('contactSubtype');
- if ($csType) {
- $templateFile = "CRM/Contact/Page/View/SubType/{$csType}.tpl";
- $template = CRM_Core_Page::getTemplate();
- if ($template->template_exists($templateFile)) {
- return $templateFile;
+ $contactSubtypes = $this->get('contactSubtype') ?
+ explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : array();
+
+ // there could be multiple subtypes. We check templates for each of the subtype, and return the first one found.
+ foreach ($contactSubtypes as $csType) {
+ if ($csType) {
+ $templateFile = "CRM/Contact/Page/View/SubType/{$csType}.tpl";
+ $template = CRM_Core_Page::getTemplate();
+ if ($template->template_exists($templateFile)) {
+ return $templateFile;
+ }
}
}
}