protected function LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekNodeCohesionRepeaterTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent()
- 3.5.x tests/src/Functional/LingotekNodeCohesionRepeaterTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent()
- 3.6.x tests/src/Functional/LingotekNodeCohesionRepeaterTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent()
- 3.7.x tests/src/Functional/LingotekNodeCohesionRepeaterTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent()
1 call to LingotekNodeCohesionRepeaterTranslationTest::createCohesionComponent()
- LingotekNodeCohesionRepeaterTranslationTest::setUp in tests/
src/ Functional/ LingotekNodeCohesionRepeaterTranslationTest.php
File
- tests/
src/ Functional/ LingotekNodeCohesionRepeaterTranslationTest.php, line 285
Class
- LingotekNodeCohesionRepeaterTranslationTest
- Tests translating a node with multiple locales including paragraphs.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function createCohesionComponent() {
$json = <<<'JSON'
{"canvas":[{"type":"container","uid":"list-container","title":"List container","status":{"collapsed":false},"uuid":"d7ff2afc-ba8a-4683-ad5c-fdae3495d7c9","parentUid":"root","isContainer":true,"children":[{"type":"container","uid":"component-pattern-repeater","title":"Pattern repeater","status":{"collapsed":false},"uuid":"9185b51b-f188-493f-9a11-dd1685b3de21","parentUid":"list-container","isContainer":true,"children":[{"type":"container","uid":"list-item","title":"List item","status":{"collapsed":false},"uuid":"1216657e-dd97-4d74-9845-9c3cd7511232","parentUid":"component-pattern-repeater","isContainer":true,"children":[{"type":"container","uid":"inline-element","title":"Inline element","status":{"collapsed":false},"uuid":"c273c296-e42b-4c46-b233-6ba4c68b97c2","parentUid":"list-item","isContainer":true,"children":[]}]}]}]}],"componentForm":[{"type":"form-field-container","uid":"form-field-repeater","title":"Field repeater","selected":false,"status":{"collapsed":false,"isopen":false},"options":{"formBuilder":true},"uuid":"a2ec3944-3dc0-476d-b84d-a7974ddf6ceb","parentUid":"root","isContainer":true,"children":[{"type":"form-field","uid":"form-input","title":"Input","translate":true,"status":{"collapsed":false},"uuid":"ee4da1c5-e659-46c4-8a22-8969134fcfa7","parentUid":"form-field-repeater","isContainer":false,"children":[]}]}],"mapper":{"d7ff2afc-ba8a-4683-ad5c-fdae3495d7c9":{"settings":{"formDefinition":[{"formKey":"list-container-settings","children":[{"formKey":"list-container-type","breakpoints":[],"activeFields":[{"name":"element","active":true}]},{"formKey":"list-container-style","breakpoints":[],"activeFields":[{"name":"customStyle","active":true},{"name":"customStyle","active":true}]}]}],"selectorType":"topLevel","form":null,"items":[]}},"9185b51b-f188-493f-9a11-dd1685b3de21":{"settings":{"formDefinition":[{"formKey":"component-pattern-repeater-settings","children":[{"formKey":"component-pattern-repeater-token","breakpoints":[],"activeFields":[{"name":"token","active":true}]}]}],"selectorType":"topLevel","form":null,"items":[]}},"1216657e-dd97-4d74-9845-9c3cd7511232":{"settings":{"formDefinition":[{"formKey":"list-item-settings","children":[{"formKey":"list-item-type","breakpoints":[],"activeFields":[{"name":"element","active":true}]},{"formKey":"list-item-style","breakpoints":[],"activeFields":[{"name":"customStyle","active":true},{"name":"customStyle","active":true}]}]}],"selectorType":"topLevel","form":null,"items":[]},"styles":{"formDefinition":[],"selectorType":"topLevel","items":[],"form":null}},"c273c296-e42b-4c46-b233-6ba4c68b97c2":{"settings":{"formDefinition":[{"formKey":"inline-element-settings","children":[{"formKey":"inline-element-text","breakpoints":[],"activeFields":[{"name":"content","active":true}]},{"formKey":"inline-element-markup","breakpoints":[],"activeFields":[{"name":"htmlMarkup","active":true},{"name":"htmlMarkupCustom","active":true},{"name":"helpText","active":true}]},{"formKey":"inline-element-style","breakpoints":[],"activeFields":[{"name":"customStyle","active":true},{"name":"customStyle","active":true}]}]}],"selectorType":"topLevel","form":null,"items":[]}}},"model":{"d7ff2afc-ba8a-4683-ad5c-fdae3495d7c9":{"settings":{"title":"List container","element":"ul","customStyle":[{"customStyle":""}],"settings":{"element":"ul","customStyle":[{"customStyle":""}]}},"context-visibility":{"contextVisibility":{"condition":"ALL"}},"styles":{"settings":{"element":"list-container"}}},"9185b51b-f188-493f-9a11-dd1685b3de21":{"settings":{"title":"Pattern repeater","token":"[field.a2ec3944-3dc0-476d-b84d-a7974ddf6ceb]"}},"1216657e-dd97-4d74-9845-9c3cd7511232":{"settings":{"title":"List item","element":"li","customStyle":[{"customStyle":""}],"settings":{"element":"li","customStyle":[{"customStyle":""}]}},"context-visibility":{"contextVisibility":{"condition":"ALL"}},"styles":{"settings":{"element":"list-item"}}},"c273c296-e42b-4c46-b233-6ba4c68b97c2":{"settings":{"title":"Inline element","customStyle":[{"customStyle":""}],"settings":{"htmlMarkup":"span","customStyle":[{"customStyle":""}]},"htmlMarkup":"span","content":"inline element [field.ee4da1c5-e659-46c4-8a22-8969134fcfa7]"},"context-visibility":{"contextVisibility":{"condition":"ALL"}},"styles":{"settings":{"element":"inline-element"}}},"a2ec3944-3dc0-476d-b84d-a7974ddf6ceb":{"settings":{"title":"Field repeater","type":"cohArray","componentField":true,"noTitle":true,"htmlClass":"coh-array--field-repeater","disableScrollbar":true,"addText":"Add","key":"field-repeater","sortable":true,"sortableOptions":{"axis":"y","handle":true},"schema":{"type":"array"},"machineName":"field-repeater","min":1,"max":100,"increment":1,"tooltipPlacement":"auto right"},"sortable":true,"sortableOptions":{"axis":"y","handle":true},"contextVisibility":{"condition":"ALL"}},"ee4da1c5-e659-46c4-8a22-8969134fcfa7":{"settings":{"title":"Input","schema":{"type":"string","escape":true},"machineName":"input","tooltipPlacement":"auto right"},"contextVisibility":{"condition":"ALL"}}},"previewModel":{"9185b51b-f188-493f-9a11-dd1685b3de21":{},"1216657e-dd97-4d74-9845-9c3cd7511232":{},"a2ec3944-3dc0-476d-b84d-a7974ddf6ceb":{},"ee4da1c5-e659-46c4-8a22-8969134fcfa7":{},"d7ff2afc-ba8a-4683-ad5c-fdae3495d7c9":{},"c273c296-e42b-4c46-b233-6ba4c68b97c2":{}},"variableFields":{"9185b51b-f188-493f-9a11-dd1685b3de21":[],"1216657e-dd97-4d74-9845-9c3cd7511232":[],"a2ec3944-3dc0-476d-b84d-a7974ddf6ceb":[],"ee4da1c5-e659-46c4-8a22-8969134fcfa7":[],"d7ff2afc-ba8a-4683-ad5c-fdae3495d7c9":[],"c273c296-e42b-4c46-b233-6ba4c68b97c2":[]},"meta":{"fieldHistory":[{"uuid":"ee4da1c5-e659-46c4-8a22-8969134fcfa7","type":"form-input","machineName":"input"},{"uuid":"a2ec3944-3dc0-476d-b84d-a7974ddf6ceb","type":"form-field-repeater","machineName":"field-repeater"}]}}
JSON;
$component = Component::create([
'id' => '3fedc674',
'status' => TRUE,
'label' => 'text',
'json_values' => $json,
]);
$component
->save();
}