diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index d92f1fb..4fca5bb 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -9,6 +9,7 @@ use Drupal\comment\Plugin\Core\Entity\Comment; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\CoreBundle; +use Drupal\Core\Language\Language; /** * Implements hook_uninstall(). @@ -727,7 +728,7 @@ function comment_update_8007(&$sandbox) { 'bundle' => $sandbox['node_type'], 'entity_id' => $nid, 'revision_id' => $node->vid, - 'langcode' => LANGUAGE_NOT_SPECIFIED, + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, 'delta' => 0, 'comment_node_' . $sandbox['node_type'] . '_status' => $node->comment, )); @@ -736,7 +737,7 @@ function comment_update_8007(&$sandbox) { 'bundle' => $sandbox['node_type'], 'entity_id' => $nid, 'revision_id' => $node->vid, - 'langcode' => LANGUAGE_NOT_SPECIFIED, + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, 'delta' => 0, 'comment_node_' . $sandbox['node_type'] . '_status' => $node->comment, )); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index be63190..00f6659 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; +use Drupal\Core\Language\Language; // Load all Field module hooks for Comment. require __DIR__ . '/comment.field.inc'; @@ -1523,7 +1524,7 @@ function comment_preview(CommentInterface $comment) { // loop. $values = $entity->{$comment->field_name->value}; $entity->{$comment->field_name->value} = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)), + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)), ); $build = entity_view($entity, 'full'); $entity->{$comment->field_name->value} = $values; diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index bd76c0a..a0635bf 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -9,6 +9,7 @@ use Drupal\node\Plugin\Core\Entity\Node; use Drupal\comment\Plugin\Core\Entity\Comment; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Drupal\Core\Language\Language; /** * Form constructor for the comment reply form. @@ -96,7 +97,7 @@ function comment_reply(EntityInterface $entity, $field_name, $pid = NULL) { // We make sure the field value isn't set so we don't end up with a redirect loop. $original = $entity->{$field_name}; $entity->{$field_name} = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)), + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)), ); $build['comment_entity'] = entity_view($entity, 'full'); $entity->{$field_name} = $original; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index d3b5f03..a35d54d 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -169,8 +169,8 @@ function setEnvironment(array $info) { // Change comment settings. $this->setCommentSettings('form_location', $info['form'], 'Set comment form location'); $this->setCommentAnonymous($info['contact']); - if ($this->node->comment[LANGUAGE_NOT_SPECIFIED][0]['status'] != $info['comments']) { - $this->node->comment[LANGUAGE_NOT_SPECIFIED][0]['status'] = $info['comments']; + if ($this->node->comment[Language::LANGCODE_NOT_SPECIFIED][0]['status'] != $info['comments']) { + $this->node->comment[Language::LANGCODE_NOT_SPECIFIED][0]['status'] = $info['comments']; node_save($this->node); } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php index 19bad52..56fec4a 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php @@ -7,6 +7,8 @@ namespace Drupal\comment\Tests; +use Drupal\Core\Language\Language; + /** * Tests for Comment module integration with RSS feeds. */ @@ -39,7 +41,7 @@ function testCommentRss() { $this->assertRaw($raw, 'Comments as part of RSS feed.'); // Hide comments from RSS feed and check presence. - $this->node->comment = array(LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN))); + $this->node->comment = array(Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN))); node_save($this->node); $this->drupalGet('rss.xml'); $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.'); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php index 14b76e0..3b64522 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php @@ -9,6 +9,7 @@ use Drupal\comment\Plugin\Core\Entity\Comment; use Drupal\simpletest\WebTestBase; +use Drupal\Core\Language\Language; /** * Tests basic comment functionality against a user entity. @@ -100,7 +101,7 @@ function setUp() { * array of values to set contact info. */ function postComment($account, $comment, $subject = '', $contact = NULL) { - $langcode = LANGUAGE_NOT_SPECIFIED; + $langcode = Language::LANGCODE_NOT_SPECIFIED; $edit = array(); $edit['comment_body[' . $langcode . '][0][value]'] = $comment; @@ -305,7 +306,7 @@ function testCommentUser() { $this->drupalGet('comment/reply/user/' . $this->web_user->uid . '/comment'); $this->assertText('You are not authorized to post comments', 'Error attempting to post comment.'); $this->assertNoFieldByName('subject', '', 'Subject field not found.'); - $langcode = LANGUAGE_NOT_SPECIFIED; + $langcode = Language::LANGCODE_NOT_SPECIFIED; $this->assertNoFieldByName("comment_body[$langcode][0][value]", '', 'Comment field not found.'); user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 313a802..0e99c84 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\entity\Plugin\Core\Entity\EntityDisplay; use Drupal\taxonomy\Plugin\Core\Entity\Term; +use Drupal\Core\Language\Language; /** * Implements hook_help(). @@ -925,7 +926,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $result = array(); foreach ($query->execute() as $row) { $topic = $nodes[$row->nid]; - $topic->comment_mode = !empty($topic->comment_node_forum[LANGUAGE_NOT_SPECIFIED][0]['comment']) ? $topic->comment_node_forum[LANGUAGE_NOT_SPECIFIED][0]['comment'] : COMMENT_HIDDEN; + $topic->comment_mode = !empty($topic->comment_node_forum[Language::LANGCODE_NOT_SPECIFIED][0]['comment']) ? $topic->comment_node_forum[Language::LANGCODE_NOT_SPECIFIED][0]['comment'] : COMMENT_HIDDEN; foreach ($row as $key => $value) { $topic->{$key} = $value; diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php index e7cbbe3..aa69f83 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php @@ -92,11 +92,11 @@ function testSearchCommentCountToggle() { // Test comment count display for nodes with comment status set to Closed $this->searchable_nodes['0 comments']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) ); node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['1 comment']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_CLOSED)) ); node_save($this->searchable_nodes['1 comment']); @@ -106,11 +106,11 @@ function testSearchCommentCountToggle() { // Test comment count display for nodes with comment status set to Hidden $this->searchable_nodes['0 comments']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) );; node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['1 comment']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) + Language::LANGCODE_NOT_SPECIFIED => array(array('status' => COMMENT_HIDDEN)) );; node_save($this->searchable_nodes['1 comment']); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php index 17419e0..41b9f1b 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php @@ -84,7 +84,7 @@ function testSearchResultsComment() { $edit_comment['subject'] = 'Test comment subject'; $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = '

' . $comment_body . '

'; $full_html_format_id = 'full_html'; - $edit_comment['comment_body[' . Language::LANGUAGE_NOT_SPECIFIED . '][0][format]'] = $full_html_format_id; + $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][format]'] = $full_html_format_id; $this->drupalPost('comment/reply/node/' . $node->nid .'/comment', $edit_comment, t('Save')); // Invoke search index update. @@ -146,7 +146,7 @@ function testSearchResultsCommentAccess() { // Post a comment using 'Full HTML' text format. $edit_comment = array(); $edit_comment['subject'] = $this->comment_subject; - $edit_comment['comment_body[' . Language::LANGUAGE_NOT_SPECIFIED . '][0][value]'] = '

' . $comment_body . '

'; + $edit_comment['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = '

' . $comment_body . '

'; $this->drupalPost('comment/reply/node/' . $this->node->nid . '/comment', $edit_comment, t('Save')); $this->drupalLogout(); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php index 833a1fe..848afb1 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php @@ -77,7 +77,7 @@ function testRankings() { // Add a comment to one of the nodes. $edit = array(); $edit['subject'] = 'my comment title'; - $edit['comment_body[' . Language::LANGUAGE_NOT_SPECIFIED . '][0][value]'] = 'some random comment'; + $edit['comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]'] = 'some random comment'; $this->drupalGet('comment/reply/node/' . $nodes['comments'][1]->nid . '/comment'); $this->drupalPost(NULL, $edit, t('Preview')); $this->drupalPost(NULL, $edit, t('Save'));