Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
paragraphs
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
paragraphs
Merge requests
!22
Issue
#3262149
: New non-translatable field on translatable paragraph throws error
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3262149
: New non-translatable field on translatable paragraph throws error
issue/paragraphs-3262149:3262149-new-non-translatable-field
into
8.x-1.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Mikko Rantanen
requested to merge
issue/paragraphs-3262149:3262149-new-non-translatable-field
into
8.x-1.x
3 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
8.x-1.x
version 1
85e3309a
3 years ago
8.x-1.x (HEAD)
and
latest version
latest version
ab6e4b31
1 commit,
3 years ago
version 1
85e3309a
1 commit,
3 years ago
1 file
+
52
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/src/Functional/WidgetStable/ParagraphsTranslationTest.php
+
52
−
0
Options
@@ -840,6 +840,58 @@ class ParagraphsTranslationTest extends ParagraphsTestBase {
$this
->
assertParagraphsLangcode
(
$node2
->
id
(),
'de'
);
}
/**
* Test adding a new non-translatable field to translatable paragraph.
*/
public
function
testNewNonTranslatableField
()
{
// Hide untranslatable fields from the "text_image" paragraph form.
$edit
=
[
'settings[paragraph][text_image][settings][content_translation][untranslatable_fields_hide]'
=>
TRUE
,
];
$this
->
drupalGet
(
'admin/config/regional/content-language'
);
$this
->
submitForm
(
$edit
,
'Save configuration'
);
// Use the stable widget.
$form_display
=
EntityFormDisplay
::
load
(
'paragraph.nested_paragraph.default'
)
->
setComponent
(
'field_paragraphs_demo'
,
[
'type'
=>
'paragraphs'
,
]);
$form_display
->
save
();
// Create paragraphed_content_demo node.
$this
->
drupalGet
(
'node/add/paragraphed_content_demo'
);
$this
->
submitForm
([],
'Add text_image'
);
$edit
=
[
'title[0][value]'
=>
'example_publish_unpublish'
,
'field_paragraphs_demo[0][subform][field_text_demo][0][value]'
=>
'Example published and unpublished'
,
];
$this
->
submitForm
(
$edit
,
'Save'
);
$node
=
$this
->
drupalGetNodeByTitle
(
'example_publish_unpublish'
);
// Add an untranslatable field to the 'text' paragraph.
static
::
fieldUIAddNewField
(
'admin/structure/paragraphs_type/text_image'
,
'boolean'
,
'Boolean'
,
'boolean'
,
[
'cardinality'
=>
"number"
,
'cardinality_number'
=>
"1"
,
],
[
'translatable'
=>
"0"
,
]);
$this
->
drupalGet
(
'node/'
.
$node
->
id
());
// Add french translation.
$this
->
clickLink
(
'Translate'
);
$this
->
clickLink
(
'Add'
,
1
);
$edit
=
array
(
'title[0][value]'
=>
'Title in french'
,
'field_paragraphs_demo[0][subform][field_text_demo][0][value]'
=>
'Text in french'
,
'revision'
=>
TRUE
,
'revision_log[0][value]'
=>
'french 1'
,
);
$this
->
submitForm
(
$edit
,
'Save (this translation)'
);
$this
->
assertSession
()
->
pageTextNotContains
(
'Non-translatable fields can only be changed when updating the original language.'
);
}
/**
* Passes if the paragraphs buttons are present.
*
Loading