You are here

class WebformSubmissionAjaxResponse in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Ajax/WebformSubmissionAjaxResponse.php \Drupal\webform\Ajax\WebformSubmissionAjaxResponse

Custom JSON response object for an ajax webform submission response.

We use a special response object to be able to fire a proper alter hook.

Hierarchy

Expanded class hierarchy of WebformSubmissionAjaxResponse

See also

https://www.linkedin.com/pulse/how-alter-ajax-commands-view-response-dru...

1 file declares its use of WebformSubmissionAjaxResponse
WebformAjaxFormTrait.php in src/Form/WebformAjaxFormTrait.php

File

src/Ajax/WebformSubmissionAjaxResponse.php, line 15

Namespace

Drupal\webform\Ajax
View source
class WebformSubmissionAjaxResponse extends AjaxResponse {

  /**
   * The webform submission of this ajax request.
   *
   * @var \Drupal\webform\WebformSubmissionInterface
   */
  protected $submission;

  /**
   * Sets the webform submission of this response.
   *
   * @param \Drupal\webform\WebformSubmissionInterface $webform_submission
   *   The webform submission of this ajax request.
   */
  public function setWebformSubmission(WebformSubmissionInterface $webform_submission) {
    $this->submission = $webform_submission;
  }

  /**
   * Gets the webform submission of this response.
   *
   * @return \Drupal\webform\WebformSubmissionInterface
   *   The webform submission of this ajax request.
   */
  public function getWebformSubmission() {
    return $this->submission;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AjaxResponse::$commands protected property The array of ajax commands.
AjaxResponse::addCommand public function Add an AJAX command to the response.
AjaxResponse::getCommands public function Gets all AJAX commands.
AttachmentsTrait::$attachments protected property The attachments for this response.
AttachmentsTrait::addAttachments public function
AttachmentsTrait::getAttachments public function
AttachmentsTrait::setAttachments public function
WebformSubmissionAjaxResponse::$submission protected property The webform submission of this ajax request.
WebformSubmissionAjaxResponse::getWebformSubmission public function Gets the webform submission of this response.
WebformSubmissionAjaxResponse::setWebformSubmission public function Sets the webform submission of this response.