I have a content type with a date field. The date is mandatory, but I want the option to not show the date in all displays if the option is selected. This date field is not published date.

The content type has several display modes, so I want to disable this in all of them. What would be the best way?

My thought is to add an additional boolean field, "Hide date", but then I'm not sure what is a nice clean way to hide the date field everywhere if "Hide date" is selected.

1 Answer 1


Use the #states property. Here is a tutorial.

Alternatively just use the Conditional Fields module which provides a nice easy to use UI making it easy to set up multiple rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.