Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b7959a1d
Commit
b7959a1d
authored
Jul 14, 2014
by
alexpott
Browse files
Issue
#2292821
by andypost, larowlan: Use widget for comment subject field.
parent
08c9054e
Changes
40
Hide whitespace changes
Inline
Side-by-side
core/modules/comment/comment.module
View file @
b7959a1d
...
...
@@ -118,11 +118,6 @@ function comment_entity_extra_field_info() {
'description'
=>
t
(
'Author textfield'
),
'weight'
=>
-
2
,
),
'subject'
=>
array
(
'label'
=>
t
(
'Subject'
),
'description'
=>
t
(
'Subject textfield'
),
'weight'
=>
-
1
,
),
),
);
}
...
...
core/modules/comment/config/schema/comment.schema.yml
View file @
b7959a1d
...
...
@@ -106,9 +106,6 @@ field.comment.instance_settings:
anonymous
:
type
:
integer
label
:
'
Mode'
subject
:
type
:
boolean
label
:
'
Allow
comment
title'
form_location
:
type
:
boolean
label
:
'
Allow
comment
title'
...
...
core/modules/comment/src/CommentForm.php
View file @
b7959a1d
...
...
@@ -206,14 +206,6 @@ public function form(array $form, array &$form_state) {
'#access'
=>
$is_admin
,
);
$form
[
'subject'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'Subject'
),
'#maxlength'
=>
64
,
'#default_value'
=>
$comment
->
getSubject
(),
'#access'
=>
$field_definition
->
getSetting
(
'subject'
),
);
// Used for conditional validation of author fields.
$form
[
'is_anonymous'
]
=
array
(
'#type'
=>
'value'
,
...
...
core/modules/comment/src/Entity/Comment.php
View file @
b7959a1d
...
...
@@ -225,9 +225,14 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields
[
'subject'
]
=
FieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Subject'
))
->
setDescription
(
t
(
'The comment title or subject.'
))
->
setTranslatable
(
TRUE
)
->
setSetting
(
'max_length'
,
64
);
->
setSetting
(
'max_length'
,
64
)
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string'
,
// Default comment body field has weight 20.
'weight'
=>
10
,
))
->
setDisplayConfigurable
(
'form'
,
TRUE
);
$fields
[
'uid'
]
=
FieldDefinition
::
create
(
'entity_reference'
)
->
setLabel
(
t
(
'User ID'
))
...
...
core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
View file @
b7959a1d
...
...
@@ -45,7 +45,6 @@ public static function defaultInstanceSettings() {
'per_page'
=>
50
,
'form_location'
=>
COMMENT_FORM_BELOW
,
'anonymous'
=>
COMMENT_ANONYMOUS_MAYNOT_CONTACT
,
'subject'
=>
1
,
'preview'
=>
DRUPAL_OPTIONAL
,
)
+
parent
::
defaultInstanceSettings
();
}
...
...
@@ -143,11 +142,6 @@ public function instanceSettingsForm(array $form, array &$form_state) {
),
'#access'
=>
$anonymous_user
->
hasPermission
(
'post comments'
),
);
$element
[
'comment'
][
'subject'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Allow comment title'
),
'#default_value'
=>
$settings
[
'subject'
],
);
$element
[
'comment'
][
'form_location'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Show reply form on the same page as comments'
),
...
...
core/modules/comment/src/Tests/CommentAnonymousTest.php
View file @
b7959a1d
...
...
@@ -63,7 +63,7 @@ function testAnonymous() {
$edit
=
array
(
'name'
=>
$this
->
admin_user
->
getUsername
(),
'mail'
=>
$this
->
randomName
()
.
'@example.com'
,
'subject'
=>
$this
->
randomName
(),
'subject
[0][value]
'
=>
$this
->
randomName
(),
'comment_body[0][value]'
=>
$this
->
randomName
(),
);
$this
->
drupalPostForm
(
'comment/reply/node/'
.
$this
->
node
->
id
()
.
'/comment'
,
$edit
,
t
(
'Save'
));
...
...
@@ -131,7 +131,7 @@ function testAnonymous() {
// Attempt to view node-comment form while disallowed.
$this
->
drupalGet
(
'comment/reply/node/'
.
$this
->
node
->
id
()
.
'/comment'
);
$this
->
assertText
(
'You are not authorized to post comments'
,
'Error attempting to post comment.'
);
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field not found.'
);
user_role_change_permissions
(
DRUPAL_ANONYMOUS_RID
,
array
(
...
...
@@ -151,7 +151,7 @@ function testAnonymous() {
));
$this
->
drupalGet
(
'node/'
.
$this
->
node
->
id
());
$this
->
assertNoPattern
(
'@<h2[^>]*>Comments</h2>@'
,
'Comments were not displayed.'
);
$this
->
assertFieldByName
(
'subject'
,
''
,
'Subject field found.'
);
$this
->
assertFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field found.'
);
$this
->
assertFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field found.'
);
$this
->
drupalGet
(
'comment/reply/node/'
.
$this
->
node
->
id
()
.
'/comment/'
.
$anonymous_comment3
->
id
());
...
...
core/modules/comment/src/Tests/CommentBookTest.php
View file @
b7959a1d
...
...
@@ -63,7 +63,7 @@ public function testBookCommentPrint() {
$this
->
assertText
(
$comment_subject
,
'Comment subject found'
);
$this
->
assertText
(
$comment_body
,
'Comment body found'
);
$this
->
assertText
(
t
(
'Add new comment'
),
'Comment form found'
);
$this
->
assertField
(
'subject'
,
'Comment form subject found'
);
$this
->
assertField
(
'subject
[0][value]
'
,
'Comment form subject found'
);
$this
->
drupalGet
(
'book/export/html/'
.
$book_node
->
id
());
...
...
@@ -72,7 +72,7 @@ public function testBookCommentPrint() {
$this
->
assertText
(
$comment_body
,
'Comment body found'
);
$this
->
assertNoText
(
t
(
'Add new comment'
),
'Comment form not found'
);
$this
->
assertNoField
(
'subject'
,
'Comment form subject not found'
);
$this
->
assertNoField
(
'subject
[0][value]
'
,
'Comment form subject not found'
);
}
}
core/modules/comment/src/Tests/CommentLanguageTest.php
View file @
b7959a1d
...
...
@@ -105,7 +105,7 @@ function testCommentLanguage() {
$prefix
=
empty
(
$prefixes
[
$langcode
])
?
''
:
$prefixes
[
$langcode
]
.
'/'
;
$comment_values
[
$node_langcode
][
$langcode
]
=
$this
->
randomName
();
$edit
=
array
(
'subject'
=>
$this
->
randomName
(),
'subject
[0][value]
'
=>
$this
->
randomName
(),
'comment_body[0][value]'
=>
$comment_values
[
$node_langcode
][
$langcode
],
);
$this
->
drupalPostForm
(
$prefix
.
'node/'
.
$node
->
id
(),
$edit
,
t
(
'Preview'
));
...
...
core/modules/comment/src/Tests/CommentNonNodeTest.php
View file @
b7959a1d
...
...
@@ -96,18 +96,19 @@ function postComment(EntityInterface $entity, $comment, $subject = '', $contact
$instance
=
FieldInstanceConfig
::
loadByName
(
'entity_test'
,
'entity_test'
,
'comment'
);
$preview_mode
=
$instance
->
getSetting
(
'preview'
);
$subject_mode
=
$instance
->
getSetting
(
'subject'
);
// Must get the page before we test for fields.
if
(
$entity
!==
NULL
)
{
$this
->
drupalGet
(
'comment/reply/entity_test/'
.
$entity
->
id
()
.
'/comment'
);
}
if
(
$subject_mode
==
TRUE
)
{
$edit
[
'subject'
]
=
$subject
;
// Determine the visibility of subject form field.
if
(
entity_get_form_display
(
'comment'
,
'comment'
,
'default'
)
->
getComponent
(
'subject'
))
{
// Subject input allowed.
$edit
[
'subject[0][value]'
]
=
$subject
;
}
else
{
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field not found.'
);
}
if
(
$contact
!==
NULL
&&
is_array
(
$contact
))
{
...
...
@@ -303,7 +304,7 @@ function testCommentFunctionality() {
// Attempt to view test entity comment form while disallowed.
$this
->
drupalGet
(
'comment/reply/entity_test/'
.
$this
->
entity
->
id
()
.
'/comment'
);
$this
->
assertText
(
'You are not authorized to post comments'
,
'Error attempting to post comment.'
);
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field not found.'
);
user_role_change_permissions
(
DRUPAL_ANONYMOUS_RID
,
array
(
...
...
@@ -316,7 +317,7 @@ function testCommentFunctionality() {
$this
->
assertPattern
(
'@<h2[^>]*>Comments</h2>@'
,
'Comments were displayed.'
);
$this
->
assertLink
(
'Log in'
,
0
,
'Link to log in was found.'
);
$this
->
assertLink
(
'register'
,
0
,
'Link to register was found.'
);
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field not found.'
);
// Test the combination of anonymous users being able to post, but not view
...
...
@@ -330,7 +331,7 @@ function testCommentFunctionality() {
));
$this
->
drupalGet
(
'entity_test/'
.
$this
->
entity
->
id
());
$this
->
assertNoPattern
(
'@<h2[^>]*>Comments</h2>@'
,
'Comments were not displayed.'
);
$this
->
assertFieldByName
(
'subject'
,
''
,
'Subject field found.'
);
$this
->
assertFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field found.'
);
$this
->
assertFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field found.'
);
$this
->
drupalGet
(
'comment/reply/entity_test/'
.
$this
->
entity
->
id
()
.
'/comment/'
.
$comment1
->
id
());
...
...
@@ -411,7 +412,7 @@ function testCommentFunctionality() {
$this
->
assertNoField
(
'edit-field-foobar-0-status-0'
);
$this
->
drupalGet
(
'comment/reply/entity_test/comment/'
.
$new_entity
->
id
());
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field found.'
);
$this
->
assertNoFieldByName
(
'comment_body[0][value]'
,
''
,
'Comment field found.'
);
}
...
...
core/modules/comment/src/Tests/CommentPagerTest.php
View file @
b7959a1d
...
...
@@ -307,7 +307,6 @@ function testTwoPagers() {
$comments
=
array
();
foreach
(
array
(
'comment'
,
'comment_2'
)
as
$field_name
)
{
$this
->
setCommentForm
(
TRUE
,
$field_name
);
$this
->
setCommentSubject
(
TRUE
,
$field_name
);
$this
->
setCommentPreview
(
DRUPAL_OPTIONAL
,
$field_name
);
$this
->
setCommentSettings
(
'default_mode'
,
CommentManagerInterface
::
COMMENT_MODE_FLAT
,
'Comment paging changed.'
,
$field_name
);
...
...
core/modules/comment/src/Tests/CommentPreviewTest.php
View file @
b7959a1d
...
...
@@ -50,17 +50,17 @@ function testCommentPreview() {
// As the web user, fill in the comment form and preview the comment.
$edit
=
array
();
$edit
[
'subject'
]
=
$this
->
randomName
(
8
);
$edit
[
'subject
[0][value]
'
]
=
$this
->
randomName
(
8
);
$edit
[
'comment_body[0][value]'
]
=
$this
->
randomName
(
16
);
$this
->
drupalPostForm
(
'node/'
.
$this
->
node
->
id
(),
$edit
,
t
(
'Preview'
));
// Check that the preview is displaying the title and body.
$this
->
assertTitle
(
t
(
'Preview comment | Drupal'
),
'Page title is "Preview comment".'
);
$this
->
assertText
(
$edit
[
'subject'
],
'Subject displayed.'
);
$this
->
assertText
(
$edit
[
'subject
[0][value]
'
],
'Subject displayed.'
);
$this
->
assertText
(
$edit
[
'comment_body[0][value]'
],
'Comment displayed.'
);
// Check that the title and body fields are displayed with the correct values.
$this
->
assertFieldByName
(
'subject'
,
$edit
[
'subject'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'subject
[0][value]
'
,
$edit
[
'subject
[0][value]
'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'comment_body[0][value]'
,
$edit
[
'comment_body[0][value]'
],
'Comment field displayed.'
);
// Check that the signature is displaying with the correct text format.
...
...
@@ -83,7 +83,7 @@ function testCommentEditPreviewSave() {
$edit
=
array
();
$date
=
new
DrupalDateTime
(
'2008-03-02 17:23'
);
$edit
[
'subject'
]
=
$this
->
randomName
(
8
);
$edit
[
'subject
[0][value]
'
]
=
$this
->
randomName
(
8
);
$edit
[
'comment_body[0][value]'
]
=
$this
->
randomName
(
16
);
$edit
[
'name'
]
=
$web_user
->
getUsername
();
$edit
[
'date[date]'
]
=
$date
->
format
(
'Y-m-d'
);
...
...
@@ -92,18 +92,18 @@ function testCommentEditPreviewSave() {
$expected_text_date
=
format_date
(
$raw_date
);
$expected_form_date
=
$date
->
format
(
'Y-m-d'
);
$expected_form_time
=
$date
->
format
(
'H:i:s'
);
$comment
=
$this
->
postComment
(
$this
->
node
,
$edit
[
'subject'
],
$edit
[
'comment_body[0][value]'
],
TRUE
);
$comment
=
$this
->
postComment
(
$this
->
node
,
$edit
[
'subject
[0][value]
'
],
$edit
[
'comment_body[0][value]'
],
TRUE
);
$this
->
drupalPostForm
(
'comment/'
.
$comment
->
id
()
.
'/edit'
,
$edit
,
t
(
'Preview'
));
// Check that the preview is displaying the subject, comment, author and date correctly.
$this
->
assertTitle
(
t
(
'Preview comment | Drupal'
),
'Page title is "Preview comment".'
);
$this
->
assertText
(
$edit
[
'subject'
],
'Subject displayed.'
);
$this
->
assertText
(
$edit
[
'subject
[0][value]
'
],
'Subject displayed.'
);
$this
->
assertText
(
$edit
[
'comment_body[0][value]'
],
'Comment displayed.'
);
$this
->
assertText
(
$edit
[
'name'
],
'Author displayed.'
);
$this
->
assertText
(
$expected_text_date
,
'Date displayed.'
);
// Check that the subject, comment, author and date fields are displayed with the correct values.
$this
->
assertFieldByName
(
'subject'
,
$edit
[
'subject'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'subject
[0][value]
'
,
$edit
[
'subject
[0][value]
'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'comment_body[0][value]'
,
$edit
[
'comment_body[0][value]'
],
'Comment field displayed.'
);
$this
->
assertFieldByName
(
'name'
,
$edit
[
'name'
],
'Author field displayed.'
);
$this
->
assertFieldByName
(
'date[date]'
,
$edit
[
'date[date]'
],
'Date field displayed.'
);
...
...
@@ -115,7 +115,7 @@ function testCommentEditPreviewSave() {
// Check that the comment fields are correct after loading the saved comment.
$this
->
drupalGet
(
'comment/'
.
$comment
->
id
()
.
'/edit'
);
$this
->
assertFieldByName
(
'subject'
,
$edit
[
'subject'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'subject
[0][value]
'
,
$edit
[
'subject
[0][value]
'
],
'Subject field displayed.'
);
$this
->
assertFieldByName
(
'comment_body[0][value]'
,
$edit
[
'comment_body[0][value]'
],
'Comment field displayed.'
);
$this
->
assertFieldByName
(
'name'
,
$edit
[
'name'
],
'Author field displayed.'
);
$this
->
assertFieldByName
(
'date[date]'
,
$expected_form_date
,
'Date field displayed.'
);
...
...
@@ -123,7 +123,7 @@ function testCommentEditPreviewSave() {
// Submit the form using the displayed values.
$displayed
=
array
();
$displayed
[
'subject'
]
=
(
string
)
current
(
$this
->
xpath
(
"//input[@id='edit-subject']/@value"
));
$displayed
[
'subject
[0][value]
'
]
=
(
string
)
current
(
$this
->
xpath
(
"//input[@id='edit-subject
-0-value
']/@value"
));
$displayed
[
'comment_body[0][value]'
]
=
(
string
)
current
(
$this
->
xpath
(
"//textarea[@id='edit-comment-body-0-value']"
));
$displayed
[
'name'
]
=
(
string
)
current
(
$this
->
xpath
(
"//input[@id='edit-name']/@value"
));
$displayed
[
'date[date]'
]
=
(
string
)
current
(
$this
->
xpath
(
"//input[@id='edit-date-date']/@value"
));
...
...
@@ -134,7 +134,7 @@ function testCommentEditPreviewSave() {
$comment_storage
=
\
Drupal
::
entityManager
()
->
getStorage
(
'comment'
);
$comment_storage
->
resetCache
(
array
(
$comment
->
id
()));
$comment_loaded
=
Comment
::
load
(
$comment
->
id
());
$this
->
assertEqual
(
$comment_loaded
->
getSubject
(),
$edit
[
'subject'
],
'Subject loaded.'
);
$this
->
assertEqual
(
$comment_loaded
->
getSubject
(),
$edit
[
'subject
[0][value]
'
],
'Subject loaded.'
);
$this
->
assertEqual
(
$comment_loaded
->
comment_body
->
value
,
$edit
[
'comment_body[0][value]'
],
'Comment body loaded.'
);
$this
->
assertEqual
(
$comment_loaded
->
getAuthorName
(),
$edit
[
'name'
],
'Name loaded.'
);
$this
->
assertEqual
(
$comment_loaded
->
getCreatedTime
(),
$raw_date
,
'Date loaded.'
);
...
...
core/modules/comment/src/Tests/CommentTestBase.php
View file @
b7959a1d
...
...
@@ -114,18 +114,19 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
$instance
=
FieldInstanceConfig
::
loadByName
(
'node'
,
'article'
,
$field_name
);
}
$preview_mode
=
$instance
->
settings
[
'preview'
];
$subject_mode
=
$instance
->
settings
[
'subject'
];
// Must get the page before we test for fields.
if
(
$entity
!==
NULL
)
{
$this
->
drupalGet
(
'comment/reply/node/'
.
$entity
->
id
()
.
'/'
.
$field_name
);
}
if
(
$subject_mode
==
TRUE
)
{
$edit
[
'subject'
]
=
$subject
;
// Determine the visibility of subject form field.
if
(
entity_get_form_display
(
'comment'
,
'comment'
,
'default'
)
->
getComponent
(
'subject'
))
{
// Subject input allowed.
$edit
[
'subject[0][value]'
]
=
$subject
;
}
else
{
$this
->
assertNoFieldByName
(
'subject'
,
''
,
'Subject field not found.'
);
$this
->
assertNoFieldByName
(
'subject
[0][value]
'
,
''
,
'Subject field not found.'
);
}
if
(
$contact
!==
NULL
&&
is_array
(
$contact
))
{
...
...
@@ -211,12 +212,20 @@ function deleteComment(CommentInterface $comment) {
*
* @param bool $enabled
* Boolean specifying whether the subject field should be enabled.
* @param string $field_name
* (optional) Field name through which the comment should be posted.
* Defaults to 'comment'.
*/
public
function
setCommentSubject
(
$enabled
,
$field_name
=
'comment'
)
{
$this
->
setCommentSettings
(
'subject'
,
(
$enabled
?
'1'
:
'0'
),
'Comment subject '
.
(
$enabled
?
'enabled'
:
'disabled'
)
.
'.'
,
$field_name
);
public
function
setCommentSubject
(
$enabled
)
{
$form_display
=
entity_get_form_display
(
'comment'
,
'comment'
,
'default'
);
if
(
$enabled
)
{
$form_display
->
setComponent
(
'subject'
,
array
(
'type'
=>
'string'
,
));
}
else
{
$form_display
->
removeComponent
(
'subject'
);
}
$form_display
->
save
();
// Display status message.
$this
->
pass
(
'Comment subject '
.
(
$enabled
?
'enabled'
:
'disabled'
)
.
'.'
);
}
/**
...
...
core/modules/comment/src/Tests/CommentTranslationUITest.php
View file @
b7959a1d
...
...
@@ -106,7 +106,7 @@ protected function createEntity($values, $langcode, $comment_type = 'comment_art
protected
function
getNewEntityValues
(
$langcode
)
{
// Comment subject is not translatable hence we use a fixed value.
return
array
(
'subject'
=>
$this
->
subject
,
'subject'
=>
array
(
array
(
'value'
=>
$this
->
subject
))
,
'comment_body'
=>
array
(
array
(
'value'
=>
$this
->
randomName
(
16
))),
)
+
parent
::
getNewEntityValues
(
$langcode
);
}
...
...
core/modules/forum/src/Tests/ForumTest.php
View file @
b7959a1d
...
...
@@ -451,7 +451,7 @@ function testForumWithNewPost() {
$this
->
drupalLogin
(
$this
->
post_comment_user
);
// Post a reply to the topic.
$edit
=
array
();
$edit
[
'subject'
]
=
$this
->
randomName
();
$edit
[
'subject
[0][value]
'
]
=
$this
->
randomName
();
$edit
[
'comment_body[0][value]'
]
=
$this
->
randomName
();
$this
->
drupalPostForm
(
'node/'
.
$node
->
id
(),
$edit
,
t
(
'Save'
));
$this
->
assertResponse
(
200
);
...
...
core/modules/migrate/config/schema/migrate.source.schema.yml
View file @
b7959a1d
...
...
@@ -39,69 +39,31 @@ migrate.source.variable:
migrate.source.d6_comment
:
type
:
migrate_source
label
:
'
Drupal
6
book
'
label
:
'
Drupal
6
comment
'
mapping
:
constants
:
type
:
mapping
label
:
'
Constants'
mapping
:
field_id
:
type
:
string
label
:
'
Field
ID'
entity_type
:
type
:
string
label
:
'
Entity
type'
migrate.source.d6_comment_variable
:
migrate.source.d6_comment_variable
_per_comment_type
:
type
:
migrate_source
label
:
'
Drupal
6
book
'
label
:
'
Drupal
6
comment
variable
'
mapping
:
constants
:
type
:
m
apping
type
:
m
igrate_entity_constant
label
:
'
Constants'
mapping
:
entity_type
:
type
:
string
label
:
'
Entity
type'
field_name
:
type
:
string
label
:
'
Entity
type'
view_mode
:
type
:
string
label
:
'
Entity
type'
options
:
type
:
sequence
label
:
'
Options'
sequence
:
-
type
:
string
label
:
'
Option'
type
:
type
:
string
label
:
'
Type'
id
:
type
:
string
label
:
'
ID'
name
:
type
:
label
label
:
'
Name'
migrate.source.d6_comment
:
migrate.source.d6_comment
_entity_form_display_subject
:
type
:
migrate_source
label
:
'
Drupal
6
comment'
label
:
'
Drupal
6
comment
subject
entity
form
display
'
mapping
:
constants
:
type
:
m
apping
type
:
m
igrate_entity_constant
label
:
'
Constants'
mapping
:
field_name
:
type
:
string
label
:
'
Field
name'
comment_type
:
type
:
string
label
:
'
Comment
type'
entity_type
:
type
:
string
label
:
'
Entity
type'
migrate.source.d6_box
:
type
:
migrate_source
...
...
core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
View file @
b7959a1d
...
...
@@ -26,13 +26,12 @@ public function import(Row $row, array $old_destination_id_values = array()) {
}
$entity
=
$this
->
getEntity
(
$values
[
'entity_type'
],
$values
[
'bundle'
],
$values
[
static
::
MODE_NAME
]);
if
(
!
$row
->
getDestinationProperty
(
'hidden'
))
{
$entity
->
setComponent
(
$values
[
'field_name'
],
$row
->
getDestinationProperty
(
'options'
)
?:
array
())
->
save
();
$entity
->
setComponent
(
$values
[
'field_name'
],
$row
->
getDestinationProperty
(
'options'
)
?:
array
());
}
else
{
$entity
->
removeComponent
(
$values
[
'field_name'
]);
}
$entity
->
save
();
return
array_values
(
$values
);
}
...
...
core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml
View file @
b7959a1d
...
...
@@ -3,8 +3,6 @@ label: Drupal 6 comments
source
:
plugin
:
d6_comment
constants
:
field_name
:
comment
comment_type
:
comment
entity_type
:
node
process
:
cid
:
cid
...
...
@@ -20,8 +18,10 @@ process:
migration
:
d6_node
source
:
nid
entity_type
:
'
constants/entity_type'
field_name
:
'
constants/field_name'
comment_type
:
'
constants/comment_type'
# field_name & comment_type is calculated in
# \Drupal\migrate_drupal\Plugin\migrate\source\d6\Comment::prepareRow()
field_name
:
field_name
comment_type
:
comment_type
subject
:
subject
uid
:
-
...
...
core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display.yml
View file @
b7959a1d
id
:
d6_comment_entity_form_display
label
:
Drupal 6 comment form display configuration
label
:
Drupal 6 comment
field
form display configuration
source
:
plugin
:
d6_comment_variable
constants
:
...
...
core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display_subject.yml
0 → 100644
View file @
b7959a1d
id
:
d6_comment_entity_form_display_subject
label
:
Drupal 6 comment subject form display configuration
source
:
plugin
:
d6_comment_variable_per_comment_type
constants
:
entity_type
:
comment
field_name
:
subject
form_mode
:
default
options
:
type
:
string
weight
:
10
process
:
entity_type
:
'
constants/entity_type'
field_name
:
'
constants/field_name'
form_mode
:
'
constants/form_mode'
options
:
'
constants/options'
hidden
:
plugin
:
static_map
source
:
comment_type
default_value
:
false
map
:
comment_no_subject
:
true
# Hide subject field
comment
:
false
bundle
:
comment_type
destination
:
plugin
:
component_entity_form_display
migration_dependencies
:
required
:
-
d6_comment_type
core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field.yml
View file @
b7959a1d
id
:
d6_comment_field
label
:
Drupal 6 comment field configuration
source
:
plugin
:
d6_comment_variable
plugin
:
d6_comment_variable
_per_comment_type
constants
:
entity_type
:
node
type
:
comment
id
:
node.comment
name
:
comment
settings
:
content_type
:
comment
process
:
entity_type
:
'
constants/entity_type'
id
:
'
constants/id'
name
:
'
constants/name'
name
:
comment_type
type
:
'
constants/type'
settings
:
'
co
nstants/settings'
'
settings
/comment_type'
:
co
mment_type
destination
:
plugin
:
entity:field_config
migration_dependencies
:
required
:
-
d6_comment_type
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment