Workflow: How to add "Save as Draft" button to article page?

By default we have ‘Save’ & ‘Preview’ button.

I would like to add ‘Save as draft’ button along with them using Workflow module.

Below what I have tried.

In my custom_module.module file

function custom_module_form_node_form_alter(&$form, FormStateInterface $form_state) {
  $form['actions']['draft'] = array(
    '#type' => 'submit',
    '#class' => 'form-submit',
    '#name' => 'btn-draft',
    '#value' => t('Save as draft'),
    '#weight' => '-10',
    '#submit' => ['custom_module_node_form_submit']

So above code is displaying “Save as draft” button.

function custom_module_node_form_submit(&$form, FormStateInterface $form_state) {

  $button_clicked = $form_state->getTriggeringElement()['#name'];

  if ($button_clicked == 'btn-draft') {
    if ($entity = $form_state->getFormObject()->getEntity()) {
      $entity->set('moderation_state', 'draft');

In above function having issues. It gives

The website encountered an unexpected error. Please try again later.DrupalCoreEntityEntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘title’ cannot be null: INSERT INTO {node_field_data} (nid, vid, type, langcode, status, title, uid, created, changed, promote, sticky, default_langcode, revision_translation_affected, weight, publish_on, unpublish_on, publish_state, unpublish_state) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17);


For Drupal 7 I found above link Not able to found function node_form_submit($form, $form_state); For Drupal 8

Drupal version: