DataObject conditional fields in cms

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.7

Question: How can I show fields conditionally based on the page that uses it?

I have a DataObject with two different pages in the $has_one relationship
e.g. $has_one = [ xPage, yPage]

If used on xPage I want to show additional fields.

How can I find out if this DataObject is currently used in xPage or yPage?


// Include any relevant code. If you have a lot of code, link to a gist instead.

Forget about it. It was simply too late for my brain to work properly :wink: