When extending the Sitecore Content Hub schema, certain fields may only be needed under specific conditions. Displaying these fields at all times can reduce efficiency. I introduce a feature that controls the display of these fields to address this issue.
Prerequisite
In this article, we will be working with the Sitecore Content Hub after it has been set up. The version we are working with is 4.1.5, but this feature is version-independent as it has been available since before the acquisition of this product.
Extend the schema
First, let's briefly extend the schema of the asset. First, if you open the schema of M.Asset, you will see the following settings.
For the sake of clarity, we will add a member called DemoText to Overview.
We want to add text, so we select PROPERTY.
Select String to set the string.
Then add a schema called DemoText. Change the title to Demo Text at least (it is just a visual part, and since it is a validation, it can be the same as it is).
After changing the settings, click the Apply Changes button. The schema will then be expanded. When you select an asset, the following items are displayed.
You can see that the standard Demo Text item has been added.
Controlling the display
Go back to the Demo Text section in the schema definition again. You will see that there is a tab called Conditional as a setting.
Once you have made your selection, a field for entering this item will appear.
Originally, we need to create a precondition to control the display, but this time we select a FactSheet that is included in AsssetTypeToAsset as a sample from the beginning because it will be the default item.
After changing the settings, click on the Apply Changes button to apply the settings. You will see that additional items will appear when you make selections as shown below (animated Gif).
This allowed us to see that when we selected an item, the items related to it were displayed.
Summary
As the number of input items increases, more data will appear on the screen. By setting up the system so that items appear only when they must be entered in conjunction with something else as an item for this purpose, you can also improve work efficiency by avoiding the appearance of items that are not normally needed.