FormAjaxResponseBuilderInterface.php 977 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Drupal\Core\Form;
  3. use Symfony\Component\HttpFoundation\Request;
  4. /**
  5. * Provides an interface for building AJAX form responses.
  6. */
  7. interface FormAjaxResponseBuilderInterface {
  8. /**
  9. * Builds a response for an AJAX form.
  10. *
  11. * @param \Symfony\Component\HttpFoundation\Request $request
  12. * The current request.
  13. * @param array $form
  14. * An associative array containing the structure of the form.
  15. * @param \Drupal\Core\Form\FormStateInterface $form_state
  16. * The current state of the form.
  17. * @param array $commands
  18. * An array of AJAX commands to apply to the form.
  19. *
  20. * @return \Drupal\Core\Ajax\AjaxResponse
  21. * An AJAX response representing the form and its AJAX commands.
  22. *
  23. * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  24. * Thrown if the AJAX callback is not a callable.
  25. */
  26. public function buildResponse(Request $request, array $form, FormStateInterface $form_state, array $commands);
  27. }