commit c3cbda5e8d02cf66cc4fdf71fdbcb6ff357c90ed Author: Lee Rowlands Date: Thu Nov 8 19:46:40 2012 +1000 Merged entity translation, updated for 8.x, added changes per reviews from chx and berdir diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index 258924f..1ae4490 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -127,7 +127,11 @@ function comment_admin_overview($form, &$form_state, $arg) { $query = db_select('comment', 'c') ->extend('Drupal\Core\Database\Query\PagerSelectExtender') ->extend('Drupal\Core\Database\Query\TableSortExtender'); - $query->addTag('entity_access'); + if (module_exists('node')) { + // Special case to ensure node access works. + $query->leftJoin('node', 'n', "n.nid = c.entity_id AND c.entity_type = 'node'"); + $query->addTag('node_access'); + } $result = $query ->fields('c', array('cid', 'subject', 'name', 'changed', 'entity_id', 'entity_type', 'field_name')) ->condition('c.status', $status) @@ -137,8 +141,8 @@ function comment_admin_overview($form, &$form_state, $arg) { $cids = $entity_ids = $entities = array(); - // We collect a sorted list of node_titles during the query to attach to the - // comments later. + // We collect entities grouped by entity_type so we can load them and use + // their labels. foreach ($result as $row) { $entity_ids[$row->entity_type][] = $row->entity_id; $cids[] = $row->cid; diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php index a40d95d..35490f5 100644 --- a/core/modules/comment/comment.api.php +++ b/core/modules/comment/comment.api.php @@ -174,7 +174,7 @@ function hook_comment_delete(Drupal\comment\Comment $comment) { } /** - * Controls access to commenting on an entity where the no {%entity_type}_access + * Controls access to commenting on an entity where no {%entity_type}_access * function exists for the given entity. * * Modules may implement this hook if they want to have a say in whether or not @@ -185,14 +185,19 @@ function hook_comment_delete(Drupal\comment\Comment $comment) { * The entity to which the comment field is attached. * * @return mixed - * - COMMENT_ENTITY_ACCESS_DENY: if the operation is to be denied. + * - COMMENT_ACCESS_DENY: if the operation is to be denied. * - FALSE: to not affect this operation at all. + * + * @todo replace this with entity access controls once generic access controller + * lands. + * + * @see http://drupal.org/node/1696660 */ -function hook_comment_entity_access(Drupal\entity\Entity $entity) { +function hook_comment_access(Drupal\entity\Entity $entity) { $type = $entity->entityType(); if ($type == 'comment') { - return COMMENT_ENTITY_ACCESS_DENY; + return COMMENT_ACCESS_DENY; } // Returning nothing from this function would have the same effect. diff --git a/core/modules/comment/comment.field.inc b/core/modules/comment/comment.field.inc index abb3ec3..6c2b27b 100644 --- a/core/modules/comment/comment.field.inc +++ b/core/modules/comment/comment.field.inc @@ -18,7 +18,7 @@ function comment_field_info() { 'settings' => array(), 'instance_settings' => array( 'comment' => array( - 'comment' => COMMENT_ENTITY_OPEN, + 'comment' => COMMENT_OPEN, 'comment_default_mode' => COMMENT_MODE_THREADED, 'comment_default_per_page' => 50, 'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT, @@ -55,10 +55,10 @@ function comment_field_instance_settings_form($field, $instance) { $form['comment']['comment'] = array( '#type' => 'select', '#title' => t('Default comment setting for new content'), - '#default_value' => empty($settings['comment']) ? COMMENT_ENTITY_OPEN : $settings['comment'], + '#default_value' => empty($settings['comment']) ? COMMENT_OPEN : $settings['comment'], '#options' => array( - COMMENT_ENTITY_OPEN => t('Open'), - COMMENT_ENTITY_CLOSED => t('Closed'), + COMMENT_OPEN => t('Open'), + COMMENT_CLOSED => t('Closed'), COMMENT_ENTITY_HIDDEN => t('Hidden'), ), ); @@ -119,6 +119,9 @@ function comment_instance_settings_translation_entity_process($element, $form_st $comment_form = $element; $comment_form_state['translation_entity']['key'] = 'language_configuration'; $element += translation_entity_enable_widget('comment', $element['#field_name'], $comment_form, $comment_form_state); + $element['translation_entity']['#parents'] = $element['translation_entity']['#array_parents'] = array( + 'translation_entity' + ); } return $element; } @@ -186,21 +189,21 @@ function comment_field_widget_form(&$form, &$form_state, $field, $instance, $lan } $entity_id = $entity->id(); $comment_count = empty($values['comment_count']) ? 0 : $values['comment_count']; - $comment_settings = ($values['comment'] == COMMENT_ENTITY_HIDDEN && empty($comment_count)) ? COMMENT_ENTITY_CLOSED : $values['comment']; + $comment_settings = ($values['comment'] == COMMENT_ENTITY_HIDDEN && empty($comment_count)) ? COMMENT_CLOSED : $values['comment']; $element['comment'] = array( '#type' => 'radios', '#title' => t('Comments'), '#title_display' => 'invisible', '#default_value' => $comment_settings, '#options' => array( - COMMENT_ENTITY_OPEN => t('Open'), - COMMENT_ENTITY_CLOSED => t('Closed'), + COMMENT_OPEN => t('Open'), + COMMENT_CLOSED => t('Closed'), COMMENT_ENTITY_HIDDEN => t('Hidden'), ), - COMMENT_ENTITY_OPEN => array( + COMMENT_OPEN => array( '#description' => t('Users with the "Post comments" permission can post comments.'), ), - COMMENT_ENTITY_CLOSED => array( + COMMENT_CLOSED => array( '#description' => t('Users cannot post comments, but existing comments will be displayed.'), ), COMMENT_ENTITY_HIDDEN => array( @@ -212,7 +215,7 @@ function comment_field_widget_form(&$form, &$form_state, $field, $instance, $lan if (empty($comment_count)) { $element['comment'][COMMENT_ENTITY_HIDDEN]['#access'] = FALSE; // Also adjust the description of the "closed" option. - $element['comment'][COMMENT_ENTITY_CLOSED]['#description'] = t('Users cannot post comments.'); + $element['comment'][COMMENT_CLOSED]['#description'] = t('Users cannot post comments.'); } return array($element); } @@ -251,7 +254,7 @@ function comment_field_formatter_view($entity_type, $entity, $field, $instance, } // Append comment form if needed. - if ($values['comment'] == COMMENT_ENTITY_OPEN && $comment_settings['comment_form_location'] == COMMENT_FORM_BELOW) { + if ($values['comment'] == COMMENT_OPEN && $comment_settings['comment_form_location'] == COMMENT_FORM_BELOW) { // Only show the add comment form if the user has permission and the // view mode is not search_result or search_index. if (user_access('post comments') && !empty($entity->content['#view_mode']) && diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 583822b..2fa9826 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -492,6 +492,14 @@ function comment_update_8004(&$sandbox) { 'default' => 0, 'description' => 'The entity_id to which this comment is a reply.', )); + $t = get_t(); + return $t('Updated database to reflect new comment structure'); +} + +/** + * Add new field_api fields. + */ +function comment_update_8005(&$sandbox) { // Loop over defined node_types. $node_types = array_keys(_update_7000_node_get_types()); foreach ($node_types as $node_type) { @@ -579,76 +587,118 @@ function comment_update_8004(&$sandbox) { variable_del('comment_subject_field_' . $node_type); variable_del('comment_form_location_' . $node_type); variable_del('comment_preview_' . $node_type); + } + $t = get_t(); + return $t('Created required fields for each comment bundle'); +} - // Set the initial values of comment fields for existing nodes. Note that - // contrib modules will need to handle the upgrade path on their own, as - // they are disabled during core upgrade. +/** + * Update existing values. + */ +function comment_update_8006(&$sandbox) { + + $types = array_keys(_update_7000_node_get_types()); + // Load each node type in batch and initialize field values for comment field. + if (!isset($sandbox['progress'])) { + $sandbox['progress'] = 0; + $sandbox['current_nid'] = 0; + // We track all node types here. + $sandbox['node_types'] = $types; + // We start with this node type. + $sandbox['node_type'] = array_shift($sandbox['node_types']); + $sandbox['#finished'] = 1; + $sandbox['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField(); + } - // Node table will always exist up until here because in 7.x comment - // depends on node. - $nodes = db_select('node', 'n') - ->fields('n', array('nid', 'comment', 'vid', 'langcode')) - ->condition('type', $node_type) - ->execute() - ->fetchAllAssoc('nid'); + // Set the initial values of comment fields for existing nodes. Note that + // contrib modules will need to handle the upgrade path on their own, as + // they are disabled during core upgrade. - if (count($nodes) > 0) { - $insert = db_insert('field_data_comment_node_' . $node_type)-> - fields(array( - 'entity_type', - 'bundle', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'comment_node_' . $node_type . '_comment', - )); - $revision = db_insert('field_revision_comment_node_' . $node_type)-> - fields(array( - 'entity_type', - 'bundle', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'comment_node_' . $node_type . '_comment', - )); + // Node table will always exist up until here because in 7.x comment + // depends on node. + $nodes = db_select('node', 'n') + ->fields('n', array('nid', 'comment', 'vid', 'langcode')) + ->condition('type', $sandbox['node_type']) + ->condition('nid', $sandbox['current_nid'], '>') + ->range(0, 50) + ->orderBy('nid', 'ASC') + ->execute() + ->fetchAllAssoc('nid'); - // Update the field name to match the node type. - db_update('comment')->fields( - array('field_name' => 'comment_node_' . $node_type) - )->condition('entity_id', array_keys($nodes)) - ->execute(); - foreach ($nodes as $nid => $node) { - $insert->values(array( - 'entity_type' => 'node', - 'bundle' => $node_type, - 'entity_id' => $nid, - 'revision_id' => $node->vid, - 'langcode' => $node->langcode, - 'delta' => 0, - 'comment_node_' . $node_type . '_comment' => $node->comment, - )); - $revision->values(array( - 'entity_type' => 'node', - 'bundle' => $node_type, - 'entity_id' => $nid, - 'revision_id' => $node->vid, - 'langcode' => $node->langcode, - 'delta' => 0, - 'comment_node_' . $node_type . '_comment' => $node->comment, - )); - } - $insert->execute(); - $revision->execute(); + if (count($nodes) > 0) { + $insert = db_insert('field_data_comment_node_' . $sandbox['node_type'])-> + fields(array( + 'entity_type', + 'bundle', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_node_' . $sandbox['node_type'] . '_comment', + )); + $revision = db_insert('field_revision_comment_node_' . $sandbox['node_type'])-> + fields(array( + 'entity_type', + 'bundle', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_node_' . $sandbox['node_type'] . '_comment', + )); + + // Update the field name to match the node type. + db_update('comment')->fields( + array('field_name' => 'comment_node_' . $sandbox['node_type']) + )->condition('entity_id', array_keys($nodes)) + ->execute(); + foreach ($nodes as $nid => $node) { + $insert->values(array( + 'entity_type' => 'node', + 'bundle' => $sandbox['node_type'], + 'entity_id' => $nid, + 'revision_id' => $node->vid, + 'langcode' => $node->langcode, + 'delta' => 0, + 'comment_node_' . $sandbox['node_type'] . '_comment' => $node->comment, + )); + $revision->values(array( + 'entity_type' => 'node', + 'bundle' => $sandbox['node_type'], + 'entity_id' => $nid, + 'revision_id' => $node->vid, + 'langcode' => $node->langcode, + 'delta' => 0, + 'comment_node_' . $sandbox['node_type'] . '_comment' => $node->comment, + )); + $sandbox['progress']++; + $sandbox['current_nid'] = $nid; } + $insert->execute(); + $revision->execute(); + } + else { + // Move to the next node type. + $sandbox['node_type'] = array_shift($sandbox['node_types']); + // Reset the current nid pointer. + $sandbox['current_nid'] = 0; } + $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); + + $t = get_t(); + return $t('Migrated existing node comment settings to field api.'); +} +/** + * Remove the existing fields. + */ +function comment_update_8007(&$sandbox) { // Remove the {node}.comment field. db_drop_field('node', 'comment'); // Remove the {node_revision}.comment field. db_drop_field('node_revision', 'comment'); - return t('Updated comment module to field api.'); + $t = get_t(); + return $t('Removed old fields.'); } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 9f2baea..511fca2 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -73,21 +73,21 @@ /** * Comments for this entity are closed. */ -const COMMENT_ENTITY_CLOSED = 1; +const COMMENT_CLOSED = 1; /** * Comments for this entity are open. */ -const COMMENT_ENTITY_OPEN = 2; +const COMMENT_OPEN = 2; /** * Denotes that access is denied for an entity to which a comment field is * attached and no {%entity_type}_access function exists. * - * Modules should return this value from hook_comment_entity_access() to deny + * Modules should return this value from hook_comment_access() to deny * access to commenting on an entity */ -const COMMENT_ENTITY_ACCESS_DENY = 'deny'; +const COMMENT_ACCESS_DENY = 'deny'; /** * Denotes the time cutoff for comments marked as read. @@ -174,7 +174,7 @@ function comment_entity_view($entity, $view_mode, $langcode) { } $values = field_get_items($entity->entityType(), $entity, $field_name); $value = reset($values); - if (!empty($value['comment']) && $value['comment'] == COMMENT_ENTITY_OPEN) { + if (!empty($value['comment']) && $value['comment'] == COMMENT_OPEN) { $comment_form_location = $instance['settings']['comment']['comment_form_location']; if (user_access('post comments')) { $links['comment-add'] = array( @@ -202,7 +202,7 @@ function comment_entity_view($entity, $view_mode, $langcode) { // indexing or constructing a search result excerpt. $values = field_get_items($entity->entityType(), $entity, $field_name); if (is_array($values) && ($value = reset($values)) && - !empty($value['comment']) && $value['comment'] == COMMENT_ENTITY_OPEN) { + !empty($value['comment']) && $value['comment'] == COMMENT_OPEN) { $comment_form_location = $instance['settings']['comment']['comment_form_location']; if (user_access('post comments')) { // Show the "post comment" link if the form is on another page, or @@ -402,10 +402,21 @@ function comment_menu() { 'page callback' => 'comment_reply', 'page arguments' => array(3, 4), 'load arguments' => array('%map'), - 'access callback' => 'comment_entity_reply_access', + 'access callback' => 'comment_reply_access', 'access arguments' => array(3), 'file' => 'comment.pages.inc', ); + // Legacy redirect handler for links of form comment/reply/%nid + if (module_exists('node')) { + $items['comment/reply/%node'] = array( + 'title' => 'Add new comment', + 'page callback' => 'comment_node_redirect', + 'page arguments' => array(2), + 'access callback' => 'node_access', + 'access arguments' => array('view', 2), + 'file' => 'comment.pages.inc', + ); + } return $items; } @@ -437,7 +448,7 @@ function comment_entity_reply_load($entity_id, $args) { * @return bool * TRUE or FALSE if the user has access */ -function comment_entity_reply_access(Drupal\Core\Entity\EntityInterface $entity) { +function comment_reply_access(Drupal\Core\Entity\EntityInterface $entity) { $function = $entity->entityType() . '_access'; // @todo replace this with entity access controls once generic access // controller lands. @@ -450,9 +461,9 @@ function comment_entity_reply_access(Drupal\Core\Entity\EntityInterface $entity) return user_view_access($entity); } // We can't know how to control access to this entity, invoke - // hook_comment_entity_access and if no other modules object, grant access. - $access = module_invoke_all('comment_entity_access', $entity); - return !in_array(COMMENT_ENTITY_ACCESS_DENY, $access, TRUE); + // hook_comment_access and if no other modules object, grant access. + $access = module_invoke_all('comment_access', $entity); + return !in_array(COMMENT_ACCESS_DENY, $access, TRUE); } /** @@ -628,7 +639,6 @@ function comment_permalink($cid) { */ function comment_get_recent($number = 10) { $query = db_select('comment', 'c'); - $query->addTag('comment_entity_access'); $query->addMetaData('base_table', 'comment'); $query->fields('c') ->condition('c.status', COMMENT_PUBLISHED); @@ -638,7 +648,7 @@ function comment_get_recent($number = 10) { $query->addTag('node_access'); $query->condition(db_or() ->condition('n.status', NODE_PUBLISHED) - ->condition('n.status', NULL, 'IS NULL') + ->isNull('n.status') ); } $comments = $query->orderBy('c.created', 'DESC') @@ -965,7 +975,7 @@ function comment_links(Comment $comment, Drupal\Core\Entity\EntityInterface $ent $links = array(); $items = field_get_items($entity->entityType(), $entity, $field_name); $status = reset($items); - if ($status['comment'] == COMMENT_ENTITY_OPEN) { + if ($status['comment'] == COMMENT_OPEN) { if (user_access('administer comments') && user_access('post comments')) { $links['comment-delete'] = array( 'title' => t('delete'), @@ -1211,8 +1221,6 @@ function comment_node_update_index(Node $node, $langcode) { /** * Implements hook_update_index(). - * - * @todo - find out what this is for? */ function comment_update_index() { // Store the maximum possible comments per thread (used for ranking by reply count) @@ -1234,7 +1242,7 @@ function comment_node_search_result($node) { // Do not make a string if comments are hidden. if (user_access('access comments') && ($items = field_get_items('node', $node, $field_name)) && ($item = reset($items)) && $item['comment'] != COMMENT_ENTITY_HIDDEN) { - if ($item['comment'] == COMMENT_ENTITY_OPEN) { + if ($item['comment'] == COMMENT_OPEN) { // At least one comment field is open. $open = TRUE; } @@ -2110,7 +2118,7 @@ function comment_mark(Comment $comment) { * (optional) Field name to use for the comment field. Defaults to 'comment'. * @param string $default_value * (optional) Default value, one of COMMENT_ENTITY_HIDDEN, - * COMMENT_ENTITY_OPEN, COMMENT_ENTITY_CLOSED. Defaults to + * COMMENT_OPEN, COMMENT_CLOSED. Defaults to * COMMENT_ENTITY_HIDDEN. */ function comment_add_default_comment_field($entity_type, $bundle, $field_name = 'comment', $default_value = COMMENT_ENTITY_HIDDEN) { @@ -2163,7 +2171,7 @@ function comment_add_default_comment_field($entity_type, $bundle, $field_name = 'required' => 1, 'settings' => array( 'comment' => array( - 'comment' => COMMENT_ENTITY_OPEN, + 'comment' => COMMENT_OPEN, 'comment_default_mode' => COMMENT_MODE_THREADED, 'comment_default_per_page' => 50, 'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT, diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index d8de0c2..75eb39d 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -104,7 +104,7 @@ function comment_reply(Drupal\Core\Entity\EntityInterface $entity, $field_name, // Should we show the reply box? $items = field_get_items($entity->entityType(), $entity, $field_name); $status = reset($items); - if (isset($status['comment']) && $status['comment'] != COMMENT_ENTITY_OPEN) { + if (isset($status['comment']) && $status['comment'] != COMMENT_OPEN) { drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error'); drupal_goto($uri['path']); } @@ -150,3 +150,23 @@ function comment_approve($cid) { } throw new NotFoundHttpException(); } + +/** + * Page callback: Legacy handler to redirect old comment reply urls to new url. + * + * @param Drupal\node\Plugin\Core\Entity\Node $node + * The node to which the comments are attached. + * @param int $pid + * (optional) Some comments are replies to other comments. In those cases, + * $pid is the parent comment's comment ID. Defaults to NULL. + */ +function comment_node_redirect(Drupal\node\Plugin\Core\Entity\Node $node, $pid = NULL) { + $fields = comment_get_comment_fields('node'); + foreach ($fields as $field_name => $detail) { + // Pick the first comment field found on the node. + if (in_array($node->bundle(), $detail['bundles']['node'], TRUE)) { + drupal_goto('comment/reply/node/' . $node->id() . '/' . $field_name); + } + } + throw new NotFoundHttpException(); +} diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index 8631fad..502f288 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -338,7 +338,7 @@ public function save(array $form, array &$form_state) { $status = reset($items); $uri = $entity->uri(); - if (user_access('post comments') && (user_access('administer comments') || $status['comment'] == COMMENT_ENTITY_OPEN)) { + if (user_access('post comments') && (user_access('administer comments') || $status['comment'] == COMMENT_OPEN)) { // Save the anonymous user information to a cookie for reuse. if (user_is_anonymous()) { user_cookie_save(array_intersect_key($form_state['values'], array_flip(array('name', 'mail', 'homepage')))); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php index 64ddddd..f9a92f1 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeComment.php @@ -28,9 +28,9 @@ function render($values) { case COMMENT_ENTITY_HIDDEN: default: return t('Hidden'); - case COMMENT_ENTITY_CLOSED: + case COMMENT_CLOSED: return t('Closed'); - case COMMENT_ENTITY_OPEN: + case COMMENT_OPEN: return t('Open'); } } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/NodeComment.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/NodeComment.php index dd6bd8e..44f6e46 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/NodeComment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/NodeComment.php @@ -25,8 +25,8 @@ class NodeComment extends InOperator { function get_value_options() { $this->value_options = array( COMMENT_ENTITY_HIDDEN => t('Hidden'), - COMMENT_ENTITY_CLOSED => t('Closed'), - COMMENT_ENTITY_OPEN => t('Open'), + COMMENT_CLOSED => t('Closed'), + COMMENT_OPEN => t('Open'), ); } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php index 4533b3d..e5ca92f 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php @@ -45,7 +45,7 @@ function testCommentClasses() { foreach ($permutations as $case) { // Create a new node. - $node = $this->drupalCreateNode(array('type' => 'article', 'uid' => $case['node_uid'], 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('type' => 'article', 'uid' => $case['node_uid'], 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); // Add a comment. $comment = entity_create('comment', array( diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php index ba8bdc9..76d8301 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php @@ -139,14 +139,14 @@ function testCommentInterface() { $this->assertNoField('edit-comment', 'Comment body field found.'); // Attempt to post to node with read-only comments. - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_CLOSED))))); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_CLOSED))))); $this->assertTrue($this->node, 'Article node created.'); $this->drupalGet('comment/reply/node/' . $this->node->nid . '/comment'); $this->assertText('This discussion is closed', 'Posting to node with comments read-only'); $this->assertNoField('edit-comment', 'Comment body field found.'); // Attempt to post to node with comments enabled (check field names etc). - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $this->assertTrue($this->node, 'Article node created.'); $this->drupalGet('comment/reply/node/' . $this->node->nid . '/comment'); $this->assertNoText('This discussion is closed', 'Posting to node with comments enabled'); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php index 8bcbc6c..b20c361 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php @@ -102,7 +102,7 @@ function testCommentLanguage() { "title" => $title, "body[$langcode_not_specified][0][value]" => $this->randomName(), "langcode" => $node_langcode, - "comment[$langcode_not_specified][0][comment]" => COMMENT_ENTITY_OPEN, + "comment[$langcode_not_specified][0][comment]" => COMMENT_OPEN, ); $this->drupalPost("node/add/article", $edit, t('Save')); $node = $this->drupalGetNodeByTitle($title); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index 78aa527..8470f81 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -53,7 +53,7 @@ function testCommentLinks() { // test; there is only a difference between open and closed registration. 'user_register' => array(USER_REGISTER_VISITORS, USER_REGISTER_ADMINISTRATORS_ONLY), // @todo Complete test coverage for: - //'comments' => array(COMMENT_ENTITY_OPEN, COMMENT_ENTITY_CLOSED, COMMENT_ENTITY_HIDDEN), + //'comments' => array(COMMENT_OPEN, COMMENT_CLOSED, COMMENT_ENTITY_HIDDEN), //// COMMENT_ANONYMOUS_MUST_CONTACT is irrelevant for this test. //'contact ' => array(COMMENT_ANONYMOUS_MAY_CONTACT, COMMENT_ANONYMOUS_MAYNOT_CONTACT), ); @@ -80,7 +80,7 @@ function testCommentLinks() { * USER_REGISTER_VISITORS. * - contact: COMMENT_ANONYMOUS_MAY_CONTACT or * COMMENT_ANONYMOUS_MAYNOT_CONTACT. - * - comments: COMMENT_ENTITY_OPEN, COMMENT_ENTITY_CLOSED, or + * - comments: COMMENT_OPEN, COMMENT_CLOSED, or * COMMENT_ENTITY_HIDDEN. * - User permissions: * These are granted or revoked for the user, according to the @@ -102,7 +102,7 @@ function setEnvironment(array $info) { 'form' => COMMENT_FORM_BELOW, 'user_register' => USER_REGISTER_VISITORS, 'contact' => COMMENT_ANONYMOUS_MAY_CONTACT, - 'comments' => COMMENT_ENTITY_OPEN, + 'comments' => COMMENT_OPEN, 'access comments' => 0, 'post comments' => 0, // Enabled by default, because it's irrelevant for this test. @@ -181,8 +181,8 @@ function setEnvironment(array $info) { COMMENT_ANONYMOUS_MUST_CONTACT => 'required', ); $t_comments = array( - COMMENT_ENTITY_OPEN => 'open', - COMMENT_ENTITY_CLOSED => 'closed', + COMMENT_OPEN => 'open', + COMMENT_CLOSED => 'closed', COMMENT_ENTITY_HIDDEN => 'hidden', ); $verbose = $info; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php index b3e5bc4..af94601 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php @@ -31,7 +31,7 @@ function testCommentPaging() { $this->setCommentPreview(DRUPAL_DISABLED); // Create a node and three comments. - $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $comments = array(); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); @@ -107,7 +107,7 @@ function testCommentOrderingThreading() { $this->setCommentsPerPage(1000); // Create a node and three comments. - $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $comments = array(); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); @@ -208,7 +208,7 @@ function testCommentNewPageIndicator() { $this->setCommentsPerPage(1); // Create a node and three comments. - $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $comments = array(); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php index e5d34f3..7628ae2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php @@ -76,7 +76,7 @@ function setUp() { comment_add_default_comment_field('node', 'article'); // Create a test node authored by the web user. - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); } /** diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php index bf07e1b..7c59f37 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php @@ -34,7 +34,7 @@ function testCommentThreading() { // Create a node. $this->drupalLogin($this->web_user); - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); // Post comment #1. $this->drupalLogin($this->web_user); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 98b96e8..6cb7d57 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -35,7 +35,7 @@ function testCommentTokenReplacement() { $this->setCommentSubject(TRUE); // Create a node and a comment. - $node = $this->drupalCreateNode(array('type' => 'article', 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('type' => 'article', 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $parent_comment = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE); // Post a reply to the comment. diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php index 21c56f6..6a8a584 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentUserTest.php @@ -84,7 +84,7 @@ function setUp() { 'skip comment approval', )); - $this->web_user->comment = array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))); + $this->web_user->comment = array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))); $this->web_user->save(); } @@ -165,7 +165,7 @@ function postComment($account, $comment, $subject = '', $contact = NULL) { /** * Checks current page for specified comment. * - * @param use Drupal\comment\Plugin\Core\Entity\comment $comment + * @param Drupal\comment\Plugin\Core\Entity\comment $comment * The comment object. * @param boolean $reply * Boolean indicating whether the comment is a reply to another comment. diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php index 23b0d5a..acc5d08 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php @@ -269,7 +269,7 @@ function testPrivateFileComment() { $langcode = LANGUAGE_NOT_SPECIFIED; $edit = array( 'title' => $this->randomName(), - "comment[$langcode][0][comment]" => COMMENT_ENTITY_OPEN + "comment[$langcode][0][comment]" => COMMENT_OPEN ); $this->drupalPost('node/add/article', $edit, t('Save')); $node = $this->drupalGetNodeByTitle($edit['title']); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index ce6fd0f..39ef4fd 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -69,7 +69,7 @@ function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); // Add a comment field. comment_add_default_comment_field('node', 'page'); - $this->node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $this->node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); } /** diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index dc6faab..9fdbe07 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -112,7 +112,7 @@ function forum_enable() { $types = node_type_get_types(); node_add_body_field($types['forum']); // Add the comment field. - comment_add_default_comment_field('node', 'forum', 'comment_node_forum', COMMENT_ENTITY_OPEN); + comment_add_default_comment_field('node', 'forum', 'comment_node_forum', COMMENT_OPEN); } /** diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 9dad7a1..867da16 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -1280,7 +1280,7 @@ function template_preprocess_forum_icon(&$variables) { $variables['icon_title'] = $variables['new_posts'] ? t('New comments') : t('Normal topic'); } - if ($variables['comment_mode'] == COMMENT_ENTITY_CLOSED || $variables['comment_mode'] == COMMENT_ENTITY_HIDDEN) { + if ($variables['comment_mode'] == COMMENT_CLOSED || $variables['comment_mode'] == COMMENT_ENTITY_HIDDEN) { $variables['icon_class'] = 'closed'; $variables['icon_title'] = t('Closed topic'); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php index 230413f..e5c8833 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php @@ -44,7 +44,7 @@ public function testCommentPager() { // Create a node. $node = $this->drupalCreateNode( array('comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) )) ); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php index de7dbb9..6b56da6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php @@ -47,7 +47,7 @@ function testNodeTitle() { 'title' => $this->randomName(8), 'promote' => 1, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ) ); $node = $this->drupalCreateNode($settings); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php index 024e8c4..289a7b2 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php @@ -63,8 +63,8 @@ public function setUp() { // Creates the nodes on which the test comments will be posted. $this->drupalLogin($this->web_user); - $this->node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); - $this->node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $this->node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); + $this->node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); $this->drupalLogout(); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php index 774851d..65460fa 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php @@ -54,9 +54,9 @@ function setUp() { */ function testAttributesInTracker() { // Create node as anonymous user. - $node_anon = $this->drupalCreateNode(array('type' => 'article', 'uid' => 0, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node_anon = $this->drupalCreateNode(array('type' => 'article', 'uid' => 0, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); // Create node as admin user. - $node_admin = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node_admin = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1, 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); // Pass both the anonymously posted node and the administrator posted node // through to test for the RDF attributes. diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php index 914ffd8..9f3da36 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php @@ -52,7 +52,7 @@ function setUp() { $node_params = array( 'type' => 'article', 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => 'SearchCommentToggleTestCase'))), - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) ); $this->searchable_nodes['1 comment'] = $this->drupalCreateNode($node_params); @@ -96,11 +96,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('comment' => COMMENT_ENTITY_CLOSED)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_CLOSED)) ); node_save($this->searchable_nodes['0 comments']); $this->searchable_nodes['1 comment']->comment = array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_CLOSED)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_CLOSED)) ); 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 b979933..655adad 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php @@ -80,7 +80,7 @@ function testSearchResultsComment() { 'type' => 'article', 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_ENTITY_OPEN) + array('comment' => COMMENT_OPEN) ) ) )); @@ -150,7 +150,7 @@ function testSearchResultsCommentAccess() { 'type' => 'article', 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_ENTITY_OPEN) + array('comment' => COMMENT_OPEN) ) ) )); @@ -247,7 +247,7 @@ function testAddNewComment() { 'body' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => 'short body text'))), 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_ENTITY_OPEN) + array('comment' => COMMENT_OPEN) ) ) ); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php index 1f27da6..f9b913f 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchRankingTest.php @@ -57,7 +57,7 @@ function testRankings() { $settings['created'] = REQUEST_TIME + 3600; break; case 'comments': - $settings['comment'][LANGUAGE_NOT_SPECIFIED][0]['comment'] = COMMENT_ENTITY_OPEN; + $settings['comment'][LANGUAGE_NOT_SPECIFIED][0]['comment'] = COMMENT_OPEN; break; } } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 7677afa..68b3211 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -205,7 +205,7 @@ function drupalGetNodeByTitle($title, $reset = FALSE) { * ); * @endcode * - title: Random string. - * - comment: COMMENT_ENTITY_OPEN. + * - comment: COMMENT_OPEN. * - changed: REQUEST_TIME. * - promote: NODE_NOT_PROMOTED. * - log: Empty string. diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php index c3eb83e..8198785 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php @@ -69,7 +69,7 @@ protected function assertHookMessageOrder($messages) { * Tests hook invocations for CRUD operations on comments. */ public function testCommentHooks() { - comment_add_default_comment_field('node', 'article', 'comment', COMMENT_ENTITY_OPEN); + comment_add_default_comment_field('node', 'article', 'comment', COMMENT_OPEN); $node = entity_create('node', array( 'uid' => 1, 'type' => 'article', @@ -78,7 +78,7 @@ public function testCommentHooks() { 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( array( - 'comment' => COMMENT_ENTITY_OPEN + 'comment' => COMMENT_OPEN ) ) ), diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php index 541f760..ebec2ef 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php @@ -98,7 +98,7 @@ function setUp() { taxonomy_term_save($this->term); // Add a comment field. - comment_add_default_comment_field('node', 'article', 'comment', COMMENT_ENTITY_OPEN); + comment_add_default_comment_field('node', 'article', 'comment', COMMENT_OPEN); // Create a test node tagged with the test term. $this->node = $this->drupalCreateNode(array( 'title' => $this->xss_label, diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php index 2588bf1..6811684 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php @@ -35,7 +35,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); node_access_rebuild(); - comment_add_default_comment_field('node', 'page', 'comment', COMMENT_ENTITY_OPEN); + comment_add_default_comment_field('node', 'page', 'comment', COMMENT_OPEN); variable_set('node_access_test_private', TRUE); } diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php index 9284247..32bdcce 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php @@ -64,14 +64,14 @@ function testTrackerAll() { 'title' => $this->randomName(8), 'status' => 0, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $published = $this->drupalCreateNode(array( 'title' => $this->randomName(8), 'status' => 1, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); @@ -97,7 +97,7 @@ function testTrackerUser() { 'uid' => $this->user->uid, 'status' => 0, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $my_published = $this->drupalCreateNode(array( @@ -105,7 +105,7 @@ function testTrackerUser() { 'uid' => $this->user->uid, 'status' => 1, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $other_published_no_comment = $this->drupalCreateNode(array( @@ -118,7 +118,7 @@ function testTrackerUser() { 'uid' => $this->other_user->uid, 'status' => 1, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $comment = array( @@ -177,7 +177,7 @@ function testTrackerNewComments() { $node = $this->drupalCreateNode(array( 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_ENTITY_OPEN + 'comment' => COMMENT_OPEN ))), 'title' => array(LANGUAGE_NOT_SPECIFIED => array(array('value' => $this->randomName(8)))), )); @@ -222,7 +222,7 @@ function testTrackerCronIndexing() { for ($i = 1; $i <= 3; $i++) { $edits[$i] = array( 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array( - 'comment' => COMMENT_ENTITY_OPEN + 'comment' => COMMENT_OPEN ))), 'title' => $this->randomName(), ); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php index 7edcfbf..b9128e2 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php @@ -57,7 +57,7 @@ function testUserCancelWithoutPermission() { 'uid' => $account->uid, 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_ENTITY_CLOSED) + array('comment' => COMMENT_CLOSED) ) ) )); @@ -132,7 +132,7 @@ function testUserCancelInvalid() { // Create a node. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); // Attempt to cancel account. @@ -212,7 +212,7 @@ function testUserBlockUnpublish() { // Create a node with two revisions. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $settings = get_object_vars($node); $settings['revision'] = 1; @@ -259,14 +259,14 @@ function testUserAnonymize() { // Create a simple node. $node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); // Create a node with two revisions, the initial one belonging to the // cancelling user. $revision_node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $revision = $revision_node->vid; $settings = get_object_vars($revision_node); @@ -318,7 +318,7 @@ function testUserDelete() { 'uid' => $account->uid, 'comment' => array( LANGUAGE_NOT_SPECIFIED => array( - array('comment' => COMMENT_ENTITY_OPEN) + array('comment' => COMMENT_OPEN) ) ) )); @@ -340,7 +340,7 @@ function testUserDelete() { // cancelling user. $revision_node = $this->drupalCreateNode(array( 'uid' => $account->uid, - 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))) + 'comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))) )); $revision = $revision_node->vid; $settings = get_object_vars($revision_node); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php index 8b01cf4..4eb2944 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php @@ -78,7 +78,7 @@ function setUp() { */ function testUserSignature() { // Create a new node with comments on (default). - $node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN))))); + $node = $this->drupalCreateNode(array('comment' => array(LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN))))); // Verify that user signature field is not displayed on registration form. $this->drupalGet('user/register'); diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php index d4cfb2c..980bd2d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php @@ -34,13 +34,13 @@ function setUp() { $this->node_user_posted = $this->drupalCreateNode(array( 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $this->node_user_commented = $this->drupalCreateNode(array( 'uid' => $this->account2->uid, 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php index 5c98e87..92c6c76 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php @@ -72,7 +72,7 @@ public function setUp() { // Add a node of the new content type. $node_data = array( 'type' => $content_type->type, - "comment[$language_not_specified][0][comment]" => COMMENT_ENTITY_OPEN + "comment[$language_not_specified][0][comment]" => COMMENT_OPEN ); comment_add_default_comment_field('node', $content_type->type); diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 91ae217..5999c31 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -96,7 +96,7 @@ protected function setUp() { $values = array('created' => $time, 'type' => 'page'); $values[$this->field_name][LANGUAGE_NOT_SPECIFIED][]['tid'] = $term->tid; - $values['comment'][LANGUAGE_NOT_SPECIFIED][]['comment'] = COMMENT_ENTITY_OPEN; + $values['comment'][LANGUAGE_NOT_SPECIFIED][]['comment'] = COMMENT_OPEN; // Make every other node promoted. if ($i % 2) { diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php index ae89020..e109dad 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php @@ -43,7 +43,7 @@ public function testGetEntity() { 'uid' => $account->id(), 'type' => 'page', 'comment' => array( - LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_ENTITY_OPEN)) + LANGUAGE_NOT_SPECIFIED => array(array('comment' => COMMENT_OPEN)) ), )); $node->save();