protected function LingotekTestBase::saveLingotekContentTranslationSettings in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.1.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.2.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.3.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.6.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
- 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::saveLingotekContentTranslationSettings()
Save Lingotek content translation settings.
Example:
$this
->saveLingotekContentTranslationSettings([
'node' => [
'article' => [
'profiles' => 'automatic',
'fields' => [
'title' => 1,
'body' => 1,
],
'moderation' => [
'upload_status' => 'draft',
'download_transition' => 'request_review',
],
],
],
'paragraph' => [
'image_text' => [
'fields' => [
'field_image_demo' => [
'title',
'alt',
],
'field_text_demo' => 1,
],
],
],
]);
Parameters
array $settings: The settings we want to save.
55 calls to LingotekTestBase::saveLingotekContentTranslationSettings()
- LingotekActionsTest::testActionsCreatedWhenEnablingTranslations in tests/
src/ Functional/ Actions/ LingotekActionsTest.php - Tests that a node can be deleted in the management page.
- LingotekContentEntityGetProfileHookTest::testGetProfileWithoutParentProfile in tests/
src/ Functional/ LingotekContentEntityGetProfileHookTest.php - Tests that a profile can be overridden before uploading.
- LingotekContentEntityGetProfileHookTest::testProfileOverrideOnUploadTranslation in tests/
src/ Functional/ LingotekContentEntityGetProfileHookTest.php - Tests that a profile can be overridden before uploading.
- LingotekContentEntityGetProfileHookTest::testProfileWithNullProfile in tests/
src/ Functional/ LingotekContentEntityGetProfileHookTest.php - Tests that a profile can be overridden before uploading.
- LingotekContentModerationSettingsTest::testContentModerationSettings in tests/
src/ Functional/ LingotekContentModerationSettingsTest.php - Tests that the content moderation settings are stored correctly.
File
- tests/
src/ Functional/ LingotekTestBase.php, line 590
Class
- LingotekTestBase
- Base class for Lingotek test. Performs authorization of the account.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function saveLingotekContentTranslationSettings($settings) {
$edit = [];
foreach ($settings as $entity_type => $entity_type_settings) {
foreach ($entity_type_settings as $bundle_id => $bundle_settings) {
$edit[$entity_type . '[' . $bundle_id . '][enabled]'] = 1;
if (isset($bundle_settings['profiles']) && $bundle_settings['profiles'] !== NULL) {
$edit[$entity_type . '[' . $bundle_id . '][profiles]'] = $bundle_settings['profiles'];
}
foreach ($bundle_settings['fields'] as $field_id => $field_properties) {
$edit[$entity_type . '[' . $bundle_id . '][fields][' . $field_id . ']'] = 1;
if (is_array($field_properties)) {
foreach ($field_properties as $field_property) {
$edit[$entity_type . '[' . $bundle_id . '][fields][' . $field_id . ':properties][' . $field_property . ']'] = $field_property;
}
}
}
if (isset($bundle_settings['moderation']) && $bundle_settings['moderation'] !== NULL) {
$edit[$entity_type . '[' . $bundle_id . '][moderation][upload_status]'] = $bundle_settings['moderation']['upload_status'];
$edit[$entity_type . '[' . $bundle_id . '][moderation][download_transition]'] = $bundle_settings['moderation']['download_transition'];
}
}
}
$this
->drupalPostForm('admin/lingotek/settings', $edit, 'Save', [], 'lingoteksettings-tab-content-form');
}