You are here

function better_revisions_log_combine in Better Revisions 8

Same name and namespace in other branches
  1. 7 better_revisions.module \better_revisions_log_combine()

Custom submit handler to combine list and text area values.

1 string reference to 'better_revisions_log_combine'
better_revisions_form_alter in ./better_revisions.module
Implements hook_form_alter().

File

./better_revisions.module, line 78
Main enhanced revisions module file.

Code

function better_revisions_log_combine($form, &$form_state) {
  if ($form_state
    ->getValue('revision_log_extra')) {
    $log = [
      '#type' => 'inline_template',
      '#template' => '{{ wrapper }}: {{ log }}',
      '#context' => [
        'wrapper' => Xss::filter($form_state
          ->getValue('revision_log_wrapper')),
        'log' => Xss::filter($form_state
          ->getValue('revision_log_extra')),
      ],
    ];
    $form_state
      ->setValue([
      'revision_log',
      0,
      'value',
    ], \Drupal::service('renderer')
      ->render($log));
    $form_state
      ->unsetValue('revision_log_extra');
  }
}