public function LingotekLanguageContentSettingsForm::form in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 4.0.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.0.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.1.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.2.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.3.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.4.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.6.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.7.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
- 3.8.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm::form()
Alters the Drupal language content settings form for removing the lingotek fields that we don't want to be enabled for translation.
Parameters
array $form: The form definition array for the language content settings.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ LingotekLanguageContentSettingsForm.php, line 44
Class
- LingotekLanguageContentSettingsForm
- Alters the Drupal language content settings form.
Namespace
Drupal\lingotek\FormCode
public function form(array &$form, FormStateInterface $form_state) {
$entity_types = $form['entity_types']['#options'];
foreach ($entity_types as $entity_type_id => $entity_type) {
$bundles = $this->entityBundleInfo
->getBundleInfo($entity_type_id);
foreach ($bundles as $bundle => $bundle_info) {
if (isset($form['settings'][$entity_type_id][$bundle]['fields'])) {
$bundle_fields = $form['settings'][$entity_type_id][$bundle]['fields'];
$keys = [
'lingotek_metadata',
'lingotek_translation_source',
];
foreach ($keys as $key) {
if (array_key_exists($key, $bundle_fields)) {
unset($form['settings'][$entity_type_id][$bundle]['fields'][$key]);
}
}
}
}
}
}