Turn off revisions for content types that contain certain types of fields (e.g. Field Collection) The Field Collection module does not support revisions. Yes there are lots of patches which are still under review. But what I want to do is create a module that on the node edit screen, queries the fields of the content type and removes the Revision Information tab (or disables the "Create new revision" checkbox) if the content type has one or more Field Collection fields. Any help on how which hook to use, how to query the fields of a node, and how to disable the revisions tab would be very helpful. This module needs to be applied to hundreds of sites.

Thanks to pcambra, here is my module:

function epc_no_revisions_for_fc_form_node_form_alter(&amp;$form, $form_state) {

    $collection_fields = field_read_fields(array('type' =&gt; 'field_collection'));

    foreach($collection_fields as $FC){
        if(isset($form['#node']-&gt;$FC['field_name'])){
            $form['revision_information']['#access'] = FALSE;
            drupal_set_message("This node cannot accept revisions because it contains the following Field Collection: " . $FC['field_name'],'status');
        }
    }
}


UPDATE:

The above module didn't handle a fresh node where the fields had not yet been set. So I revised it to first load all the fields in the database and see if any belong to the bundle (content type) in question:

function epc_no_revisions_for_fc_form_node_form_alter(&amp;$form, $form_state) {
    if(_epc_no_revisions_for_fc_test_for_fc($form['#node']-&gt;type)){
        drupal_set_message("Please note: This node cannot accept revisions because it contains a Field Collection",'status');
        $form['revision_information']['#access'] = FALSE;
    }
}

function epc_no_revisions_for_fc_node_presave($node) {
    if(_epc_no_revisions_for_fc_test_for_fc($node-&gt;type)){
        if($node-&gt;revision == 1){
            $node-&gt;revision = 0;
            drupal_set_message("No revision was created because the content type contains a Field Collection",'status');
        }
    }
}

function _epc_no_revisions_for_fc_test_for_fc($node_type){
    $fields = field_info_fields();
    foreach($fields as $field){
        if($field['type'] == 'field_collection'){
            foreach(array_shift($field['bundles']) as $content_type){
                if($node_type == $content_type){
                    return true;

                }
            }
        }
    }
    return false;
}
You could use hook_form_FORM_ID_alter to alter your node forms of the content type (s) you need.

function my_module_form_node_form_alter(&amp;$form, $form_state) {
  if ($form['#node']-&gt;type == 'my_content_type') {
    // Your code goes here.
  }
}


Now you need to know whether or not it has a field collection field on it. You can use one of the field api functions for this, for example, this will give you the field collections in your site:

$collection_fields = field_read_fields(array('type' =&gt; 'field_collection'));


Then you can check if your node has one of these to see if you disable the revision feature or not.

You can disable the checkbox appearance by adding an #access FALSE:

$form['revision_information']['#access'] = FALSE;


It's probably safer to repeat this operation and checks in hook_node_presave if that makes sense for your workflow.

Additionally, there are a couple of modules relevant to this issue, Jammer allows you to hide some specifics from the node creation form and so on, but nothing condition based. There's also Field SQL no revisions that will skip saving information for revisions, be careful because there's no come back from this one so you need to be very sure you're not using revisions for your fields in any other content type.