Programmatically disable content translation options in content edit form I want to programmatically disable the content translation options located at the bottom of the content edit form (see yellow area in screenshot):


I know that i can disable the revision information options with the following code in a form_alter hook:

$form['revision_information']['#access'] = false; // &lt;--- works


But that doesn't work with the translation options, at least with what I tried:

$form['content_translation']['#access'] = false; // &lt;--- doesn't work


So ideally, how can i disable the whole yellow area?
You can not access to content_translation property in the hook_form_alter but you can do it in after_build callback.  


  after_build: runs after the form or element is built for display.


Try with the following:


Add #after_build to the form:



 
/**
 *Implements hook_form_alter().
 */
function myModule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == 'node_YouContentType_edit_form') {
    $form['#after_build'][] = 'myModule_after_build';
  }
}




Implement your after_build function 




    function myModule_after_build($form, &$form_state){
      $form['content_translation']['#access'] = FALSE;
      return $form;
    }