How to stop same-state state changes in Workflow state change block? I am using Workflow with a custom content type. I have the Workflow state transition form as a sidebar on my node view page. I made the workflow states into buttons so that you can choose which state to transition to. 

How can I remove buttons that are the same state as the node? For example: If the node is already in Draft state, the Draft button should not be shown. If it's in Declined mode, the Declined button should not be shown.
Implement hook_form_workflow_transition_form_alter().

/**
 * Implements hook_form_form_id_alter().
 * Alter transition form to remove current state button.
 */
function MYMODULE_form_workflow_transition_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  // Get current state to remove current state button.
  $current_sid = $form['workflow']['workflow_sid']['#default_value'];
  unset($form['workflow']['workflow_sid']['#options'][$current_sid]);

  // By default workflow button label became (Update workflow) if the options
  // count equal one. So, We will use the state label name instead of
  // (Update workflow).
  // Check if option count equal one.
  if (is_array($form['workflow']['workflow_sid']['#options']) &amp;&amp; (count($form['workflow']['workflow_sid']['#options']) == 1)) {
    $submit_label = current($form['workflow']['workflow_sid']['#options']);
    $form['workflow']['actions']['submit']['#value'] = $submit_label;
  }
}