You are here

public function MediaBundleForm::ajaxTypeProviderData in Media entity 8

Ajax callback triggered by the type provider select element.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: Current form state.

Return value

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

File

src/MediaBundleForm.php, line 72

Class

MediaBundleForm
Form controller for node type forms.

Namespace

Drupal\media_entity

Code

public function ajaxTypeProviderData(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $plugin = $this->entity
    ->getType()
    ->getPluginId();
  $response
    ->addCommand(new ReplaceCommand('#edit-type-configuration-plugin-wrapper', $form['type_configuration'][$plugin]));
  $response
    ->addCommand(new ReplaceCommand('#field-mapping-wrapper', $form['field_mapping']));
  return $response;
}