You are here

function type_style_moderation_form_workflow_transition_edit_form_alter in Type Style 8

Implements hook_form_FORM_ID_alter().

File

modules/type_style_moderation/type_style_moderation.module, line 54
Hook implementations for the Type Style Moderation module.

Code

function type_style_moderation_form_workflow_transition_edit_form_alter(array &$form, FormStateInterface $form_state) {
  $transition_id = $form['id']['#value'];

  /** @var \Drupal\workflows\WorkflowInterface $workflow */
  $workflow = $form_state
    ->getFormObject()
    ->getEntity();
  $type_plugin = $workflow
    ->getTypePlugin();
  $config = $type_plugin
    ->getConfiguration();
  $settings = isset($config['transitions'][$transition_id]['type_style']) ? $config['transitions'][$transition_id]['type_style'] : [];
  type_style_attach_to_form($form, $settings, 'Transition');
  array_splice($form['actions']['submit']['#submit'], 1, 0, [
    'type_style_moderation_form_workflow_transition_edit_form_submit',
  ]);
}