Body: <p>I'm encountering some strange and frustrating behavior in the <strong>Contact Layout Editor (CLE)</strong> web UI.</p>
  <p>My goal is to display custom tabs when viewing contacts of type Individual. The tabs show up on the left side in the Shoreditch theme.</p>
  <p>I create the custom saved search and table search display via SearchKit.</p>
  <p>I create the form to display the table search display via FormBuilder, ticking the box &quot;Add to Contact Summary Page&quot; and selecting &quot;As Tab&quot; under Form Settings &gt; Placement. I do not specify any contact type in the &quot;For&quot; field. I save the form.</p>
  <p>At this point, if I go into Contact Layout Editor, I can see my new tab at the top in the &quot;System Default&quot; layout. Yay.</p>
  <p>However as soon as I go into FormBuilder and set a contact type &quot;Individual&quot; for the &quot;Add to Contact Summary Page&quot; &gt; &quot;As Tab&quot; &gt; &quot;For&quot; field, then <em>the new tab disappears from CLE &quot;System Default&quot; layout</em> (and any other custom layouts I have created in CLE).</p>
  <p>This is unexpected. Why does the tab disappear in the CLE layouts?</p>
  <p>Even if I create a custom layout in CLE for the specified contact type (Individual), that tab still doesn't show up. It's hidden in CLE for some odd reason.</p>
  <p>If I go back into FormBuilder and clear the contact type &quot;For&quot; field, <em>then the tab reappears on the CLE &quot;System Default&quot; layout</em>. Great, at least I can get the tab back.</p>
  <p>However this makes the CLE web UI practically useless if I can't trust that it's keeping the tabs, especially when I want to override the default tab ordering and visibility.</p>
  <p>I have spent hours trying to figure this out and researching online without finding a solution.</p>
  <p>It sure seems like a bug in CLE.</p>
  <p>Am I missing something?</p>
  <p>Appreciate any ideas. Thanks!</p>
  <pre><code>Here's my Dev Environment: 
   - Civicrm 5.62.0
   - Shoreditch civicrm theme 
   - Contact Layout Editor: Version 2.2.0
   - Drupal 10.0.9
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-16T02:08:24.167Z
Comments.Text: HI. Welcome. can you replicate the issue on https://dmaster.demo.civicrm.org/ or does it not allow you the same combination of extensions etc. assuming it is not d10 specific. and have you tried switching the civi theme?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-16T13:38:47.247Z
Comments.Text: Thanks @petednz-fuzion. Yes, it's happening there as well. I just added a saved search, display table and a form in FormBuilder called "Test - Contributions". When you go into CLE System Default layout on that demo site, you'll see the tab appears and disappears depending on if a contact type filter is set or not in FormBuilder.
Comments.UserDisplayName: Justin657
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-16T19:51:13.060Z
Comments.Text: I haven't used CLE much. Have you tried changing themes for civi?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-21T19:40:08.347Z
Comments.Text: Yeah same issue if I switch from Shoreditch back to the default Greenwich backend theme.
Comments.UserDisplayName: Justin657
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-21T20:04:03.520Z
Comments.Text: So far I think I've narrowed it down to the Afform code that controls those tabs:
  
  **[civicrm-core/ext/afform/core/afform.php > function afform_civicrm_tabset](https://github.com/civicrm/civicrm-core/blob/8fc44dee73b6c88d05b5436c259e721aa89293ab/ext/afform/core/afform.php#L177)**
  
  If I comment out the first if statement in the foreach loop, I get better results, but not perfect. 
  
  I'm not setup to debug or do proper development on the code, so I hope someone can pick this up and look into it as a potential bug.
Comments.UserDisplayName: Justin657
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-22T20:56:32.837Z
Comments.Text: would be helpful if you could create an issue in gitlab https://lab.civicrm.org/dev/core/-/issues
Comments.UserDisplayName: petednz - fuzion
Tags: <formbuilder><contact-layout-editor>
Title: Tabs in the Contact Layout Editor (CLE) disappear when a Contact Type filter is added in FormBuilder
ThreadText: # Tabs in the Contact Layout Editor (CLE) disappear when a Contact Type filter is added in FormBuilder
  
  (Asked by: username_0 on 2023-06-15)
  
  I'm encountering some strange and frustrating behavior in the Contact Layout Editor (CLE) web UI.
  My goal is to display custom tabs when viewing contacts of type Individual. The tabs show up on the left side in the Shoreditch theme.
  I create the custom saved search and table search display via SearchKit.
  I create the form to display the table search display via FormBuilder, ticking the box "Add to Contact Summary Page" and selecting "As Tab" under Form Settings > Placement. I do not specify any contact type in the "For" field. I save the form.
  At this point, if I go into Contact Layout Editor, I can see my new tab at the top in the "System Default" layout. Yay.
  However as soon as I go into FormBuilder and set a contact type "Individual" for the "Add to Contact Summary Page" > "As Tab" > "For" field, then the new tab disappears from CLE "System Default" layout (and any other custom layouts I have created in CLE).
  This is unexpected. Why does the tab disappear in the CLE layouts?
  Even if I create a custom layout in CLE for the specified contact type (Individual), that tab still doesn't show up. It's hidden in CLE for some odd reason.
  If I go back into FormBuilder and clear the contact type "For" field, then the tab reappears on the CLE "System Default" layout. Great, at least I can get the tab back.
  However this makes the CLE web UI practically useless if I can't trust that it's keeping the tabs, especially when I want to override the default tab ordering and visibility.
  I have spent hours trying to figure this out and researching online without finding a solution.
  It sure seems like a bug in CLE.
  Am I missing something?
  Appreciate any ideas. Thanks!
  Here's my Dev Environment: 
   - Civicrm 5.62.0
   - Shoreditch civicrm theme 
   - Contact Layout Editor: Version 2.2.0
   - Drupal 10.0.9
  
  **Tags:** formbuilder, contact-layout-editor
  
  > **Comments:**
  > **username_1**: HI. Welcome. can you replicate the issue on https://dmaster.demo.civicrm.org/ or does it not allow you the same combination of extensions etc. assuming it is not d10 specific. and have you tried switching the civi theme?  
  > **username_0**: Thanks @petednz-fuzion. Yes, it's happening there as well. I just added a saved search, display table and a form in FormBuilder called "Test - Contributions". When you go into CLE System Default layout on that demo site, you'll see the tab appears and disappears depending on if a contact type filter is set or not in FormBuilder.  
  > **username_1**: I haven't used CLE much. Have you tried changing themes for civi?  
  > **username_0**: Yeah same issue if I switch from Shoreditch back to the default Greenwich backend theme.  
  > **username_0**: So far I think I've narrowed it down to the Afform code that controls those tabs:  **[civicrm-core/ext/afform/core/afform.php > function afform_civicrm_tabset](https://github.com/civicrm/civicrm-core/blob/8fc44dee73b6c88d05b5436c259e721aa89293ab/ext/afform/core/afform.php#L177)**  If I comment out the first if statement in the foreach loop, I get better results, but not perfect.   I'm not setup to debug or do proper development on the code, so I hope someone can pick this up and look into it as a potential bug.  
  > **username_1**: would be helpful if you could create an issue in gitlab https://lab.civicrm.org/dev/core/-/issues  
  
  ---
  
  ## 0 answers
  
  