class LingotekLanguageContentSettingsForm in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 4.0.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.0.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.1.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.2.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.3.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.4.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.5.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.6.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
- 3.7.x src/Form/LingotekLanguageContentSettingsForm.php \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm
Alters the Drupal language content settings form.
@package Drupal\lingotek\Form
Hierarchy
- class \Drupal\lingotek\Form\LingotekLanguageContentSettingsForm uses StringTranslationTrait
Expanded class hierarchy of LingotekLanguageContentSettingsForm
1 string reference to 'LingotekLanguageContentSettingsForm'
1 service uses LingotekLanguageContentSettingsForm
File
- src/
Form/ LingotekLanguageContentSettingsForm.php, line 14
Namespace
Drupal\lingotek\FormView source
class LingotekLanguageContentSettingsForm {
use StringTranslationTrait;
/**
* The entity type bundle info service.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
protected $entityBundleInfo;
/**
* Constructs a new LingotekConfigTranslationService object.
*
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_bundle_info
* The entity type bundle info service.
*/
public function __construct(EntityTypeBundleInfoInterface $entity_bundle_info) {
$this->entityBundleInfo = $entity_bundle_info;
}
/**
* Alters the Drupal language content settings form for removing the lingotek
* fields that we don't want to be enabled for translation.
*
* @param array $form
* The form definition array for the language content settings.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
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]);
}
}
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LingotekLanguageContentSettingsForm:: |
protected | property | The entity type bundle info service. | |
LingotekLanguageContentSettingsForm:: |
public | function | Alters the Drupal language content settings form for removing the lingotek fields that we don't want to be enabled for translation. | |
LingotekLanguageContentSettingsForm:: |
public | function | Constructs a new LingotekConfigTranslationService object. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |