Overrides ParagraphsTestBase::setUp
protected function setUp() : void {
parent::setUp();
$this
->placeDefaultBlocks();
$this
->addParagraphedContentType('paragraphed_test');
ConfigurableLanguage::createFromLangcode('de')
->save();
$this
->createEditorialWorkflow('paragraphed_test');
$this
->loginAsAdmin([
'access administration pages',
'view any unpublished content',
'view all revisions',
'revert all revisions',
'view latest version',
'view any unpublished content',
'use ' . $this->workflow
->id() . ' transition create_new_draft',
'use ' . $this->workflow
->id() . ' transition publish',
'use ' . $this->workflow
->id() . ' transition archived_published',
'use ' . $this->workflow
->id() . ' transition archived_draft',
'use ' . $this->workflow
->id() . ' transition archive',
'administer nodes',
'bypass node access',
'administer content translation',
'translate any entity',
'create content translations',
'administer languages',
'administer content types',
'administer node form display',
'edit any paragraphed_test content',
'create paragraphed_test content',
'edit behavior plugin settings',
]);
$this->visitorUser = $this
->drupalCreateUser([
'access content',
'view all revisions',
]);
// Add a Paragraph type.
$this
->addParagraphsType('text');
$this
->addParagraphsType('container');
// Enable the "Test bold text plugin" to have a behavior form.
$this
->drupalGet('/admin/structure/paragraphs_type/text');
$edit = [
'behavior_plugins[test_bold_text][enabled]' => TRUE,
];
$this
->submitForm($edit, 'Save');
// Add a text field to the text_paragraph type.
static::fieldUIAddNewField('admin/structure/paragraphs_type/text', 'text', 'Text', 'text_long', [], []);
// Add an untranslatable string field.
static::fieldUIAddNewField('admin/structure/paragraphs_type/text', 'untranslatable', 'Untranslatable text', 'string', [], []);
$this
->addParagraphsField('container', 'field_paragraphs', 'paragraph');
$this
->drupalGet('admin/config/regional/content-language');
$this
->assertSession()
->pageTextContains('Paragraph types that are used in moderated content requires non-translatable fields to be edited in the original language form and this must be checked.');
$edit = [
'entity_types[paragraph]' => TRUE,
'entity_types[node]' => TRUE,
'settings[node][paragraphed_test][translatable]' => TRUE,
'settings[node][paragraphed_test][fields][field_paragraphs]' => FALSE,
'settings[node][paragraphed_test][settings][language][language_alterable]' => TRUE,
'settings[paragraph][text][translatable]' => TRUE,
'settings[paragraph][container][translatable]' => TRUE,
// Because the paragraph entity itself is not directly enabled in the
// workflow, these options must be enabled manually.
'settings[paragraph][text][settings][content_translation][untranslatable_fields_hide]' => TRUE,
'settings[paragraph][container][settings][content_translation][untranslatable_fields_hide]' => TRUE,
'settings[paragraph][text][fields][field_text]' => TRUE,
'settings[paragraph][text][fields][field_untranslatable]' => FALSE,
'settings[paragraph][container][fields][field_paragraphs]' => FALSE,
];
$this
->submitForm($edit, 'Save configuration');
}