You are here

public static function EntityFormProxy::ajax in Varbase Media 9.0.x

Same name and namespace in other branches
  1. 8.7 modules/entity_browser_generic_embed/src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\entity_browser_generic_embed\Plugin\EntityBrowser\Widget\EntityFormProxy::ajax()
  2. 8.5 modules/entity_browser_generic_embed/src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\entity_browser_generic_embed\Plugin\EntityBrowser\Widget\EntityFormProxy::ajax()
  3. 8.6 modules/entity_browser_generic_embed/src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\entity_browser_generic_embed\Plugin\EntityBrowser\Widget\EntityFormProxy::ajax()

AJAX callback. Returns the rebuilt inline entity form.

Parameters

array $form: The complete form.

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

Return value

\Drupal\Core\Ajax\AjaxResponse The AJAX response.

File

modules/entity_browser_generic_embed/src/Plugin/EntityBrowser/Widget/EntityFormProxy.php, line 178

Class

EntityFormProxy
Base class for EB widgets which wrap around an (inline) entity form.

Namespace

Drupal\entity_browser_generic_embed\Plugin\EntityBrowser\Widget

Code

public static function ajax(array &$form, FormStateInterface $form_state) {
  return (new AjaxResponse())
    ->addCommand(new ReplaceCommand('#entity', $form['widget']['entity']));
}