Hi,
thanks for all the good words 🙂
1. To add new tab to RecordBrowser recordset (like contacts) you can use function
Utils_RecordBrowserCommon::new_addon(<recordset name>, <module with display function>, <display function name>, <caption or function that returns caption>)
You should call this inside install script. Pretty easy example is in CRM/Contacts/Activities module:
- look in ActivitiesInstall.php, line 20 installs Activities tab under contacts, line 27 removes it during uninstall process
- inside Activities_0.php, line 58, there is a function that is called to display Activities tab under contacts
- if you would like to add actionbar icon that is always showed in contact view, you should do it in caption function (4th argument) - install looks like
Utils_RecordBrowserCommon::new_addon(...,...,..., array('My_ModuleCommon','get_my_caption'))
in common class, as it is defined above, there should be a method
public function get_my_caption() {
Base_ActionBarCommon::add('add','New car',Module::create_href(array('new_car'=>1)));
if(isset($_REQUEST['new_car'])) {
.....
}
return 'Real Caption';
}
2. As I assume you already have Cars module as RecordBrowser recordset? If yes it's easier for now to use multiselect. Sample code where $table is variable with recordset name, $theme is Base_Theme instance to display $qf (Libs/QuickForm) module.
$fav2 = array();
$fav = Utils_RecordBrowserCommon::get_records($table,array_merge(array(':Fav'=>true),$crits));
foreach($fav as $v)
$fav2[$v['id']] = call_user_func($format_callback,$v,true);
$rb2 = $this->init_module('Utils/RecordBrowser/RecordPicker');
$this->display_module($rb2, array($table ,'records',$format_callback,$crits,array()));
$theme->assign('record_add_button',$rb2->create_open_link('Add record'));
$qf->addElement('multiselect','records','',$fav2);
3. If you are modifying CRM/Calendar, tooltip generation is located in common file, line 288.
4. Recordset field in installation array, can have 'filter' key set to true - then recordset can be filtered using this field. Example: CRM/Contacts, install file, line 31, field 'Group' - at the end of the line.
Cheers
Paul