Feb 11, 2021 in Drupal 8

Revisions are a great thing for tracking changes between entities. This snippets allows you to name them different in your entity forms. To mymodule.info add:

use Drupal\Core\Form\FormStateInterface; // on top

/**
 * Implements hook_form_alter().
 */
function MYMODULE_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'ENTITYTYPE_add_form') {
    $form['revision_log']['widget'][0]['value']['#required']= TRUE;
    $form['revision_log']['widget'][0]['value']['#title'] = 'Document version number';
    $form['revision_log']['widget'][0]['value']['#description'] = 'This version number will be logged when a customer downloads or accepts a document.';
  }
}