You are here

function type_style_moderation_form_workflow_state_edit_form_submit in Type Style 8

Form submit callback for the state edit form.

1 string reference to 'type_style_moderation_form_workflow_state_edit_form_submit'
type_style_moderation_form_workflow_state_edit_form_alter in modules/type_style_moderation/type_style_moderation.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function type_style_moderation_form_workflow_state_edit_form_submit(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\content_moderation\ContentModerationState $state */
  $state = $form_state
    ->get('state');
  $state_id = $state
    ->id();

  /** @var \Drupal\workflows\WorkflowInterface $workflow */
  $workflow = $form_state
    ->getFormObject()
    ->getEntity();
  $type_plugin = $workflow
    ->getTypePlugin();
  $config = $type_plugin
    ->getConfiguration();
  $config['states'][$state_id]['type_style'] = $form_state
    ->getValue('type_style', []);
  $type_plugin
    ->setConfiguration($config);
}