Answers.Body: <p>Accomplished it by filtering field data in CRM_Custom_Page_AJAX
  in the function getMultiRecordFieldList(),
  code goes like:</p>
  <pre><code>$data_arr = array('1','2','3');
  $obj = new CRM_Profile_Page_MultipleRecordFieldsListing();
  list($fields, $attributes) = $obj-&gt;browse();
  foreach ($fields as $key =&gt; $value) {
    if($fields[$key][[custom_field_id]]['data'] &amp;&amp; !in_array($fields[$key][[custom_field_id]]['data'], $data_array)){
      unset($fields[$key]);
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T07:35:39.263Z
Answers.LastActivityDate: 2020-11-27T07:35:39.263Z
Answers.UserDisplayName: Kurogami Dono
Answers.Body: <p>This is hard to answer because the question is a bit too general and it depends what &quot;hide&quot; means. You could try something like <code>$form-&gt;removeElement('element_name');</code> in hook_civicrm_buildForm. Just for custom fields sometimes it's tricky to get the name right.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-25T15:33:08.717Z
Answers.LastActivityDate: 2020-11-25T15:33:08.717Z
Answers.UserDisplayName: Demerit
Body: <p>I have created a set of custom fields and I want to hide some data which have specific value, I have tried using</p>
  <pre><code>$smarty = CRM_Core_Smarty::singleton();
  $smarty-&gt;assign('records', []);
  </code></pre>
  <p>to try and hide all the data but they are still showing.. can anyone help me?
  thanks a lot</p>
  
Tags: <custom-fields>
Title: Alter custom field view
ThreadText: # Alter custom field view
  
  (Asked by: username_0 on 2020-11-24)
  
  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
  
  **Tags:** custom-fields
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-11-27. Score: 1 | Accepted answer
  
  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)){
      unset($fields[$key]);
    }
  }
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2020-11-25. Score: 0
  
  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.
  
  
  ---
  
  