Hi folks,

Is there a way to hide a field when it's content/value is (still) the same as it's default content (it's field setting)?
Could this be a setting for the manage display ui of display suite or maybe some global display suite setting?

I would like to try to fix this myself, but then some pointers on where in the code I need to start would be much appreciated.

Comments

Anonymous’s picture

I am not to sure what you mean by "a field when the content is (still) the same as the default content?" what is the default content? in views if you pull in information from different sources and there is duplicate content you can select the "distinct" option in the advanced options under "Query settings"

peteruithoven’s picture

Hi Bukem,
I'm sorry for being unclear. I tried to clarify my post.
In the settings of a field of a content type you can set the default content. I would really like an option for Display suite to not show the field when someone didn't change it's default value. Just like a field can be hidden when it's left empty.

I would like to try to fix this myself, but then some pointers on where in the code I need to start would be much appreciated.

peteruithoven’s picture

Hi Bukem,
I'm sorry for being unclear. I tried to clarify my post.
In the settings of a field of a content type you can set the default content. I would really like an option for Display suite to not show the field when someone didn't change it's default value. Just like a field can be hidden when it's left empty.

I would like to try to fix this myself, but then some pointers on where in the code I need to start would be much appreciated.

Anonymous’s picture

hmmm ..
You might be able to do this with hook_form_alter . I am not to sure but maybe if on the field you want you can add display hidden somehow if value = default

check out this screencast for an overview of hook_form_alter. I havnt found much other documentation for this hook but might be a solution for this

swentel’s picture

Status: Active » Closed (won't fix)

Interesting idea. You'll have to implement hook_entity_view_alter(), iterate over the fields in the $build, grab the field definition and compare default setting with current values. But that's not something currently I'd include by default in Display suite.

swentel’s picture

Issue summary: View changes

Tried to clarify my post