You are here

function _support_ticket_comment_diff_ajax_callback in Support Ticketing System 8

#ajax callback for the support ticket diff settings.

Parameters

array $form: The build form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

\Symfony\Component\HttpFoundation\Request $request: The current request.

Return value

\Drupal\Core\Ajax\AjaxResponse The ajax response of the ajax upload.

1 string reference to '_support_ticket_comment_diff_ajax_callback'
support_ticket_form_support_ticket_type_edit_form_alter in modules/support_ticket/support_ticket.module
Implements hook_form_BASE_FORM_ID_alter().

File

modules/support_ticket/support_ticket.module, line 774
Enables use of support tickets with optional time tracking.

Code

function _support_ticket_comment_diff_ajax_callback(&$form, FormStateInterface &$form_state, Request $request) {

  /** @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = \Drupal::service('renderer');
  $response = new AjaxResponse();
  $response
    ->setAttachments($form['diff']['comment_field']['#attached']);
  $output = $renderer
    ->renderRoot($form['diff']['comment_field']);
  return $response
    ->addCommand(new ReplaceCommand(NULL, $output));
}