diff --git a/core/modules/comment/comment.field.inc b/core/modules/comment/comment.field.inc index cc1e3d2..fc46785 100644 --- a/core/modules/comment/comment.field.inc +++ b/core/modules/comment/comment.field.inc @@ -106,6 +106,9 @@ function comment_field_instance_settings_form($field, $instance) { * correlates one to one with the comment bundle. */ function comment_instance_settings_translation_entity_process($element, $form_state) { +// $parents = $element['#parents']; +// array_pop($parents); +// $element['#parents'] = $parents; if (module_exists('translation_entity')) { $comment_form = $element; $comment_form_state['translation_entity']['key'] = 'language_configuration'; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php index 91bd761..175fddc 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php @@ -23,9 +23,9 @@ * "comment" * }, * settings = { - * "default_mode" = "COMMENT_MODE_THREADED", + * "default_mode" = "1", * "per_page" = "50", - * "form_location" = "COMMENT_FORM_BELOW" + * "form_location" = "1" * } * ) */ @@ -116,7 +116,7 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { $elements[] = $additions + array( '#theme' => 'comment_wrapper__' . $entity->entityType() . '__' . $entity->bundle() . '__' . $field['field_name'], '#entity' => $entity, - '#display_mode' => $comment_settings['default_mode'], + '#display_mode' => $this->settings['default_mode'], 'comments' => array(), 'comment_form' => array(), ); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentLinksFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentLinksFormatter.php index d49f7c7..3c31af8 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentLinksFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentLinksFormatter.php @@ -23,9 +23,9 @@ * "comment" * }, * settings = { - * "comment" = "TRUE", - * "new" = "TRUE", - * "add" = "TRUE" + * "comment" = "1", + * "new" = "1", + * "add" = "1" * } * ) */ @@ -86,9 +86,7 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { $field_name = $this->field['field_name']; // We only ever process first value. - // @todo Alter default field settings to - // disallow select more then 1 value cardinality. - $status = isset($items[0]['comment']) ? $items[0]['comment'] : COMMENT_OPEN;; + $status = isset($items[0]['status']) ? $items[0]['status'] : COMMENT_OPEN;; $links = array(); $uri = $entity->uri(); @@ -125,7 +123,9 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) { $link_attributes['fragment'] = 'comment-form'; $link_attributes['href'] = $uri['path']; $link_attributes['options'] = $uri['options']; - if ($this->instance['settings']['comment']['comment_form_location'] == COMMENT_FORM_SEPARATE_PAGE) { + // Get form location from default display. + $component = entity_get_display($entity->entityType(), $entity->bundle(), 'default')->getComponent($field_name); + if ($component['settings']['form_location'] == COMMENT_FORM_SEPARATE_PAGE) { $link_attributes['href'] = 'comment/reply/'. $entity->entityType() . '/' . $entity->id() .'/' . $field_name; } }