10
June

0 Comments | 0 Shares | Urdhva Tech | Tags: SubPanel

Greetings from Urdhva Tech!

Yet another interesting forum post led me dive into code base!

Aim: Calls subpanel under Task module.

2 files makes difference!

Step 1:  Create extended vardef for Tasks module > custom/Extension/modules/Tasks/Ext/Vardefs/calls_subpanel.php add following code in it.

<?php
$dictionary['Task']['fields']['calls'] = array(
    'name' => 'calls',
    'type' => 'link',
    'relationship' => 'tasks_calls',
    'module' => 'Calls',
    'bean_name' => 'Call',
    'source' => 'non-db',
    'vname' => 'LBL_CALLS',
);


$dictionary['Task']['relationships']['tasks_calls'] = array('lhs_module' => 'Tasks',
'lhs_table' => 'tasks',
'lhs_key' => 'id',
'rhs_module' => 'Calls',
'rhs_table' => 'calls',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many',
'relationship_role_column' => 'parent_type',
'relationship_role_column_value' => 'Tasks'
);


Step 2: Create a file under > custom/Extension/modules/Tasks/Ext/Layoutdefs/calls_subpanel.php 
and add following code.

<?php
$layout_defs['Tasks']['subpanel_setup']['calls'] = array(
                'order' => 10,
                'module' => 'Calls',
                'title_key' => 'LBL_CALLS',
                'subpanel_name' => 'default',
                'get_subpanel_data' => 'calls',
            'top_buttons' => array(
                array('widget_class' => 'SubPanelTopCreateButton'),
            ),
); 


Quick Repair and Rebuild!

Awesome!!
Comments are welcome!

Download attachments:
Comments
  • No Comments Found.
Post your comment