public function LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 4.0.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.0.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.1.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.2.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.4.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.5.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.6.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.7.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
- 3.8.x src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::ajaxRefreshEntityFieldsForm()
File
- src/
Form/ LingotekSettingsContentSingleForm.php, line 377
Class
- LingotekSettingsContentSingleForm
- Configure Lingotek
Namespace
Drupal\lingotek\FormCode
public function ajaxRefreshEntityFieldsForm(array $form, FormStateInterface $form_state, Request $request) {
$triggering_element = $form_state
->getTriggeringElement();
$entity_type_id = $triggering_element['#parents'][0];
$bundle = $triggering_element['#parents'][1];
$active = $triggering_element['#value'];
$provideDefaults = $form_state
->getTemporaryValue('provideDefaults') ?: [];
$provideDefaults[$entity_type_id][$bundle] = $active;
$form_state
->setTemporaryValue('provideDefaults', $provideDefaults);
// We only need to force the rebuild. No need to do anything else.
$response = new AjaxResponse();
// Extra divs will be added. See https://www.drupal.org/node/736066.
$response
->addCommand(new ReplaceCommand('#container-' . str_replace('_', '-', $entity_type_id) . '-' . $bundle, $this
->generateFieldsForm($form_state, $entity_type_id, $bundle)));
return $response;
}