public function LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 4.0.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.1.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.2.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.3.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.4.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.5.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.6.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.7.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
- 3.8.x src/Form/LingotekSettingsTabContentForm.php \Drupal\lingotek\Form\LingotekSettingsTabContentForm::ajaxRefreshEntityFieldsForm()
File
- src/
Form/ LingotekSettingsTabContentForm.php, line 446
Class
- LingotekSettingsTabContentForm
- Configure Lingotek
Namespace
Drupal\lingotek\FormCode
public function ajaxRefreshEntityFieldsForm(array $form, FormStateInterface $form_state, Request $request) {
$readOnly = FALSE;
if ($this->countTranslatableBundles > self::CONTENT_SINGLE_FORM_THRESHOLD) {
$readOnly = TRUE;
}
$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) . '-' . str_replace('_', '-', $bundle) . ($readOnly ? '-readonly' : ''), $this
->generateFieldsForm($form_state, $entity_type_id, $bundle)));
return $response;
}