I have created a set of custom fields and I want to hide some data which have specific value, I have tried using

$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('records', []);

to try and hide all the data but they are still showing.. can anyone help me? thanks a lot

2 Answers 2


Accomplished it by filtering field data in CRM_Custom_Page_AJAX in the function getMultiRecordFieldList(), code goes like:

$data_arr = array('1','2','3');
$obj = new CRM_Profile_Page_MultipleRecordFieldsListing();
list($fields, $attributes) = $obj->browse();
foreach ($fields as $key => $value) {
  if($fields[$key][[custom_field_id]]['data'] && !in_array($fields[$key][[custom_field_id]]['data'], $data_array)){

This is hard to answer because the question is a bit too general and it depends what "hide" means. You could try something like $form->removeElement('element_name'); in hook_civicrm_buildForm. Just for custom fields sometimes it's tricky to get the name right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.