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.

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 getRequestWrapperFormat()

Gets the wrapper format of the current request.

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.