trait AjaxFormHelperTrait (View source)

internal  
 

Provides a helper to for submitting an AJAX form.

Traits

Provides a helper to determine if the current request is via AJAX.

Methods

bool
isAjax()

Determines if the current request is via AJAX.

string|null
getRequestWrapperFormat()

Gets the wrapper format of the current request.

ajaxSubmit(array $form, FormStateInterface $form_state)

Submit form dialog #ajax callback.

successfulAjaxSubmit(array $form, FormStateInterface $form_state)

Allows the form to respond to a successful AJAX submission.

Details

protected bool isAjax()

Determines if the current request is via AJAX.

Return Value

bool

TRUE if the current request is via AJAX, FALSE otherwise.

protected string|null getRequestWrapperFormat()

Gets the wrapper format of the current request.

Return Value

string|null

The wrapper format. NULL if the wrapper format is not set.

AjaxResponse ajaxSubmit(array $form, FormStateInterface $form_state)

Submit form dialog #ajax callback.

Parameters

array $form

An associative array containing the structure of the form.

FormStateInterface $form_state

The current state of the form.

Return Value

AjaxResponse

An AJAX response that display validation error messages or represents a successful submission.

abstract protected AjaxResponse successfulAjaxSubmit(array $form, FormStateInterface $form_state)

Allows the form to respond to a successful AJAX submission.

Parameters

array $form

An associative array containing the structure of the form.

FormStateInterface $form_state

The current state of the form.

Return Value

AjaxResponse

An AJAX response.