How to present a field or another in a content type, depending on context I have a custom content type, let's call it seo_data. I want that the user will be presented, in the Admin view, with some of the fields, not all, depending on the context. So for some nodes, based on nid and other database queries, the user will see, for example, fields field_image and field_image_alt or field_video and field_video_alt. So, sometimes the user will see the fields corresponding to video or image, depending on some values in other data.

The question is about how can I, programmaticaly (prefered) or with a custom module, present just a bunch of fields.
For the module approach i recommend to evaluate this one: Conditional Fields.


  Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition.
  When editing a node (or any other entity type that supports fields, like users and categories), the dependent fields are dynamically modified with the States API.