Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -3,7 +3,7 @@
|
|||
* Attaches comment behaviors to the entity form.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -20,4 +20,4 @@
|
|||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery, Drupal);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by the Comment module.
|
||||
*/
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* @addtogroup hooks
|
||||
* @{
|
||||
|
|
|
@ -127,3 +127,10 @@ function comment_update_8001() {
|
|||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-rc".
|
||||
*/
|
||||
|
||||
/**
|
||||
* Clear caches to fix Comment Views context filter.
|
||||
*/
|
||||
function comment_update_8002() {
|
||||
// Empty update to cause a cache flush.
|
||||
}
|
||||
|
|
|
@ -194,15 +194,15 @@ function comment_field_config_delete(FieldConfigInterface $field) {
|
|||
/**
|
||||
* Implements hook_node_links_alter().
|
||||
*/
|
||||
function comment_node_links_alter(array &$node_links, NodeInterface $node, array &$context) {
|
||||
function comment_node_links_alter(array &$links, NodeInterface $node, array &$context) {
|
||||
// Comment links are only added to node entity type for backwards
|
||||
// compatibility. Should you require comment links for other entity types you
|
||||
// can do so by implementing a new field formatter.
|
||||
// @todo Make this configurable from the formatter. See
|
||||
// https://www.drupal.org/node/1901110.
|
||||
|
||||
$links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context);
|
||||
$node_links += $links;
|
||||
$comment_links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context);
|
||||
$links += $comment_links;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,10 +244,10 @@ function comment_node_view_alter(array &$build, EntityInterface $node, EntityVie
|
|||
*
|
||||
* @param \Drupal\comment\CommentInterface $comment
|
||||
* The comment object.
|
||||
* @param $view_mode
|
||||
* @param string $view_mode
|
||||
* (optional) View mode; for instance, 'full', 'teaser', etc. Defaults to
|
||||
* 'full'.
|
||||
* @param $langcode
|
||||
* @param string $langcode
|
||||
* (optional) A language code to use for rendering. Defaults to the global
|
||||
* content language of the current request.
|
||||
*
|
||||
|
@ -264,12 +264,12 @@ function comment_view(CommentInterface $comment, $view_mode = 'full', $langcode
|
|||
/**
|
||||
* Constructs render array from an array of loaded comments.
|
||||
*
|
||||
* @param $comments
|
||||
* @param \Drupal\comment\CommentInterface[] $comments
|
||||
* An array of comments as returned by entity_load_multiple().
|
||||
* @param $view_mode
|
||||
* @param string $view_mode
|
||||
* (optional) View mode; for instance, 'full', 'teaser', etc. Defaults to
|
||||
* 'full'.
|
||||
* @param $langcode
|
||||
* @param string $langcode
|
||||
* (optional) A string indicating the language field values are to be shown
|
||||
* in. If no language is provided the current content language is used.
|
||||
* Defaults to NULL.
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
migrate.source.d6_comment:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 comment'
|
||||
mapping:
|
||||
constants:
|
||||
type: mapping
|
||||
label: 'Constants'
|
||||
mapping:
|
||||
entity_type:
|
||||
type: string
|
||||
label: 'Entity type'
|
||||
|
||||
migrate.source.d6_comment_variable_per_comment_type:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 comment variable'
|
||||
mapping:
|
||||
constants:
|
||||
type: migrate_entity_constant
|
||||
label: 'Constants'
|
||||
|
||||
migrate.source.d6_comment_entity_form_display_subject:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 comment subject entity form display'
|
||||
mapping:
|
||||
constants:
|
||||
type: migrate_entity_constant
|
||||
label: 'Constants'
|
||||
|
||||
migrate.source.d6_comment_variable:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 comment variable'
|
||||
mapping:
|
||||
constants:
|
||||
type: migrate_entity_constant
|
||||
label: 'Constants'
|
|
@ -6,7 +6,7 @@
|
|||
* installed.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -174,4 +174,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
})(jQuery, Drupal);
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
|
|
|
@ -37,7 +37,7 @@ destination:
|
|||
plugin: entity:comment
|
||||
migration_dependencies:
|
||||
required:
|
||||
- d6_node:*
|
||||
- d6_node
|
||||
- d6_comment_type
|
||||
- d6_comment_entity_display
|
||||
- d6_comment_entity_form_display
|
||||
|
|
2
core/modules/comment/migration_templates/d7_comment.yml
Executable file → Normal file
2
core/modules/comment/migration_templates/d7_comment.yml
Executable file → Normal file
|
@ -31,5 +31,5 @@ destination:
|
|||
plugin: entity:comment
|
||||
migration_dependencies:
|
||||
required:
|
||||
- d7_node:*
|
||||
- d7_node
|
||||
- d7_comment_type
|
||||
|
|
0
core/modules/comment/migration_templates/d7_comment_entity_display.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_entity_display.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_entity_form_display.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_entity_form_display.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_entity_form_display_subject.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_entity_form_display_subject.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_field.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_field.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_field_instance.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_field_instance.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_type.yml
Executable file → Normal file
0
core/modules/comment/migration_templates/d7_comment_type.yml
Executable file → Normal file
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentAccessControlHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
@ -31,7 +26,7 @@ class CommentAccessControlHandler extends EntityAccessControlHandler {
|
|||
if ($operation == 'approve') {
|
||||
return AccessResult::allowedIf($comment_admin && !$entity->isPublished())
|
||||
->cachePerPermissions()
|
||||
->cacheUntilEntityChanges($entity);
|
||||
->addCacheableDependency($entity);
|
||||
}
|
||||
|
||||
if ($comment_admin) {
|
||||
|
@ -41,11 +36,11 @@ class CommentAccessControlHandler extends EntityAccessControlHandler {
|
|||
|
||||
switch ($operation) {
|
||||
case 'view':
|
||||
return AccessResult::allowedIf($account->hasPermission('access comments') && $entity->isPublished())->cachePerPermissions()->cacheUntilEntityChanges($entity)
|
||||
return AccessResult::allowedIf($account->hasPermission('access comments') && $entity->isPublished())->cachePerPermissions()->addCacheableDependency($entity)
|
||||
->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE));
|
||||
|
||||
case 'update':
|
||||
return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($entity);
|
||||
return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
|
||||
|
||||
default:
|
||||
// No opinion.
|
||||
|
@ -122,9 +117,9 @@ class CommentAccessControlHandler extends EntityAccessControlHandler {
|
|||
$admin_access = AccessResult::allowedIfHasPermission($account, 'administer comments');
|
||||
$anonymous_access = AccessResult::allowedIf($entity->isNew() && $account->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT && $account->hasPermission('post comments'))
|
||||
->cachePerPermissions()
|
||||
->cacheUntilEntityChanges($entity)
|
||||
->cacheUntilEntityChanges($field_definition->getConfig($commented_entity->bundle()))
|
||||
->cacheUntilEntityChanges($commented_entity);
|
||||
->addCacheableDependency($entity)
|
||||
->addCacheableDependency($field_definition->getConfig($commented_entity->bundle()))
|
||||
->addCacheableDependency($commented_entity);
|
||||
return $admin_access->orIf($anonymous_access);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentBreadcrumbBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentFieldItemList.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Field\FieldItemList;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
@ -335,9 +330,9 @@ class CommentForm extends ContentEntityForm {
|
|||
/**
|
||||
* Form submission handler for the 'preview' action.
|
||||
*
|
||||
* @param $form
|
||||
* @param array $form
|
||||
* An associative array containing the structure of the form.
|
||||
* @param $form_state
|
||||
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
||||
* The current state of the form.
|
||||
*/
|
||||
public function preview(array &$form, FormStateInterface $form_state) {
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentLazyBuilders.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
@ -125,7 +120,7 @@ class CommentLazyBuilders {
|
|||
* @param string $langcode
|
||||
* The language in which the comment entity is being viewed.
|
||||
* @param bool $is_in_preview
|
||||
* Whether the comment is currently being previewed.
|
||||
* Whether the comment is currently being previewed.
|
||||
*
|
||||
* @return array
|
||||
* A renderable array representing the comment links.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentLinkBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentLinkBuilderInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentManagerInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentStatistics.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentStatisticsInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentStorageSchema.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityTypeInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentTranslationHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentTypeForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
|
@ -96,7 +91,7 @@ class CommentTypeForm extends EntityForm {
|
|||
$form['description'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#default_value' => $comment_type->getDescription(),
|
||||
'#description' => t('Describe this comment type. The text will be displayed on the <em>Comment types</em> administration overview page'),
|
||||
'#description' => t('Describe this comment type. The text will be displayed on the <em>Comment types</em> administration overview page.'),
|
||||
'#title' => t('Description'),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentTypeInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentTypeListBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentViewBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
|
@ -13,7 +8,6 @@ use Drupal\Core\Entity\EntityManagerInterface;
|
|||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\EntityViewBuilder;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\CommentViewsData.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
@ -20,32 +15,86 @@ class CommentViewsData extends EntityViewsData {
|
|||
public function getViewsData() {
|
||||
$data = parent::getViewsData();
|
||||
|
||||
$data['comment_field_data']['table']['base']['help'] = t('Comments are responses to content.');
|
||||
$data['comment_field_data']['table']['base']['help'] = $this->t('Comments are responses to content.');
|
||||
$data['comment_field_data']['table']['base']['access query tag'] = 'comment_access';
|
||||
|
||||
$data['comment_field_data']['table']['wizard_id'] = 'comment';
|
||||
|
||||
$data['comment_field_data']['subject']['title'] = t('Title');
|
||||
$data['comment_field_data']['subject']['help'] = t('The title of the comment.');
|
||||
$data['comment_field_data']['subject']['title'] = $this->t('Title');
|
||||
$data['comment_field_data']['subject']['help'] = $this->t('The title of the comment.');
|
||||
|
||||
$data['comment_field_data']['name']['title'] = t('Author');
|
||||
$data['comment_field_data']['name']['help'] = t("The name of the comment's author. Can be rendered as a link to the author's homepage.");
|
||||
$data['comment_field_data']['name']['title'] = $this->t('Author');
|
||||
$data['comment_field_data']['name']['help'] = $this->t("The name of the comment's author. Can be rendered as a link to the author's homepage.");
|
||||
$data['comment_field_data']['name']['field']['default_formatter'] = 'comment_username';
|
||||
|
||||
$data['comment_field_data']['homepage']['title'] = t("Author's website");
|
||||
$data['comment_field_data']['homepage']['help'] = t("The website address of the comment's author. Can be rendered as a link. Will be empty if the author is a registered user.");
|
||||
$data['comment_field_data']['homepage']['title'] = $this->t("Author's website");
|
||||
$data['comment_field_data']['homepage']['help'] = $this->t("The website address of the comment's author. Can be rendered as a link. Will be empty if the author is a registered user.");
|
||||
|
||||
$data['comment_field_data']['mail']['help'] = t('Email of user that posted the comment. Will be empty if the author is a registered user.');
|
||||
$data['comment_field_data']['mail']['help'] = $this->t('Email of user that posted the comment. Will be empty if the author is a registered user.');
|
||||
|
||||
$data['comment_field_data']['created']['title'] = t('Post date');
|
||||
$data['comment_field_data']['created']['help'] = t('Date and time of when the comment was created.');
|
||||
$data['comment_field_data']['created']['title'] = $this->t('Post date');
|
||||
$data['comment_field_data']['created']['help'] = $this->t('Date and time of when the comment was created.');
|
||||
|
||||
$data['comment_field_data']['changed']['title'] = t('Updated date');
|
||||
$data['comment_field_data']['changed']['help'] = t('Date and time of when the comment was last updated.');
|
||||
$data['comment_field_data']['created_fulldata'] = array(
|
||||
'title' => $this->t('Created date'),
|
||||
'help' => $this->t('Date in the form of CCYYMMDD.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_fulldate',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['created_year_month'] = array(
|
||||
'title' => $this->t('Created year + month'),
|
||||
'help' => $this->t('Date in the form of YYYYMM.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_year_month',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['created_year'] = array(
|
||||
'title' => $this->t('Created year'),
|
||||
'help' => $this->t('Date in the form of YYYY.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_year',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['created_month'] = array(
|
||||
'title' => $this->t('Created month'),
|
||||
'help' => $this->t('Date in the form of MM (01 - 12).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_month',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['created_day'] = array(
|
||||
'title' => $this->t('Created day'),
|
||||
'help' => $this->t('Date in the form of DD (01 - 31).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_day',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['created_week'] = array(
|
||||
'title' => $this->t('Created week'),
|
||||
'help' => $this->t('Date in the form of WW (01 - 53).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_week',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['changed']['title'] = $this->t('Updated date');
|
||||
$data['comment_field_data']['changed']['help'] = $this->t('Date and time of when the comment was last updated.');
|
||||
|
||||
$data['comment_field_data']['changed_fulldata'] = array(
|
||||
'title' => t('Created date'),
|
||||
'help' => t('Date in the form of CCYYMMDD.'),
|
||||
'title' => $this->t('Changed date'),
|
||||
'help' => $this->t('Date in the form of CCYYMMDD.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_fulldate',
|
||||
|
@ -53,8 +102,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_field_data']['changed_year_month'] = array(
|
||||
'title' => t('Created year + month'),
|
||||
'help' => t('Date in the form of YYYYMM.'),
|
||||
'title' => $this->t('Changed year + month'),
|
||||
'help' => $this->t('Date in the form of YYYYMM.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_year_month',
|
||||
|
@ -62,8 +111,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_field_data']['changed_year'] = array(
|
||||
'title' => t('Created year'),
|
||||
'help' => t('Date in the form of YYYY.'),
|
||||
'title' => $this->t('Changed year'),
|
||||
'help' => $this->t('Date in the form of YYYY.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_year',
|
||||
|
@ -71,8 +120,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_field_data']['changed_month'] = array(
|
||||
'title' => t('Created month'),
|
||||
'help' => t('Date in the form of MM (01 - 12).'),
|
||||
'title' => $this->t('Changed month'),
|
||||
'help' => $this->t('Date in the form of MM (01 - 12).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_month',
|
||||
|
@ -80,8 +129,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_field_data']['changed_day'] = array(
|
||||
'title' => t('Created day'),
|
||||
'help' => t('Date in the form of DD (01 - 31).'),
|
||||
'title' => $this->t('Changed day'),
|
||||
'help' => $this->t('Date in the form of DD (01 - 31).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_day',
|
||||
|
@ -89,43 +138,43 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_field_data']['changed_week'] = array(
|
||||
'title' => t('Created week'),
|
||||
'help' => t('Date in the form of WW (01 - 53).'),
|
||||
'title' => $this->t('Changed week'),
|
||||
'help' => $this->t('Date in the form of WW (01 - 53).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_week',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['status']['title'] = t('Approved status');
|
||||
$data['comment_field_data']['status']['help'] = t('Whether the comment is approved (or still in the moderation queue).');
|
||||
$data['comment_field_data']['status']['filter']['label'] = t('Approved comment status');
|
||||
$data['comment_field_data']['status']['title'] = $this->t('Approved status');
|
||||
$data['comment_field_data']['status']['help'] = $this->t('Whether the comment is approved (or still in the moderation queue).');
|
||||
$data['comment_field_data']['status']['filter']['label'] = $this->t('Approved comment status');
|
||||
$data['comment_field_data']['status']['filter']['type'] = 'yes-no';
|
||||
|
||||
$data['comment']['approve_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link to approve comment'),
|
||||
'help' => t('Provide a simple link to approve the comment.'),
|
||||
'title' => $this->t('Link to approve comment'),
|
||||
'help' => $this->t('Provide a simple link to approve the comment.'),
|
||||
'id' => 'comment_link_approve',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment']['replyto_comment'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link to reply-to comment'),
|
||||
'help' => t('Provide a simple link to reply to the comment.'),
|
||||
'title' => $this->t('Link to reply-to comment'),
|
||||
'help' => $this->t('Provide a simple link to reply to the comment.'),
|
||||
'id' => 'comment_link_reply',
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_field_data']['thread']['field'] = array(
|
||||
'title' => t('Depth'),
|
||||
'help' => t('Display the depth of the comment if it is threaded.'),
|
||||
'title' => $this->t('Depth'),
|
||||
'help' => $this->t('Display the depth of the comment if it is threaded.'),
|
||||
'id' => 'comment_depth',
|
||||
);
|
||||
$data['comment_field_data']['thread']['sort'] = array(
|
||||
'title' => t('Thread'),
|
||||
'help' => t('Sort by the threaded order. This will keep child comments together with their parents.'),
|
||||
'title' => $this->t('Thread'),
|
||||
'help' => $this->t('Sort by the threaded order. This will keep child comments together with their parents.'),
|
||||
'id' => 'comment_thread',
|
||||
);
|
||||
unset($data['comment_field_data']['thread']['filter']);
|
||||
|
@ -142,7 +191,7 @@ class CommentViewsData extends EntityViewsData {
|
|||
$data['comment_field_data'][$type] = array(
|
||||
'relationship' => array(
|
||||
'title' => $entity_type->getLabel(),
|
||||
'help' => t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_type->getLabel())),
|
||||
'help' => $this->t('The @entity_type to which the comment is a reply to.', array('@entity_type' => $entity_type->getLabel())),
|
||||
'base' => $entity_type->getDataTable() ?: $entity_type->getBaseTable(),
|
||||
'base field' => $entity_type->getKey('id'),
|
||||
'relationship field' => 'entity_id',
|
||||
|
@ -160,20 +209,20 @@ class CommentViewsData extends EntityViewsData {
|
|||
}
|
||||
}
|
||||
|
||||
$data['comment_field_data']['uid']['title'] = t('Author uid');
|
||||
$data['comment_field_data']['uid']['help'] = t('If you need more fields than the uid add the comment: author relationship');
|
||||
$data['comment_field_data']['uid']['relationship']['title'] = t('Author');
|
||||
$data['comment_field_data']['uid']['relationship']['help'] = t("The User ID of the comment's author.");
|
||||
$data['comment_field_data']['uid']['relationship']['label'] = t('author');
|
||||
$data['comment_field_data']['uid']['title'] = $this->t('Author uid');
|
||||
$data['comment_field_data']['uid']['help'] = $this->t('If you need more fields than the uid add the comment: author relationship');
|
||||
$data['comment_field_data']['uid']['relationship']['title'] = $this->t('Author');
|
||||
$data['comment_field_data']['uid']['relationship']['help'] = $this->t("The User ID of the comment's author.");
|
||||
$data['comment_field_data']['uid']['relationship']['label'] = $this->t('author');
|
||||
|
||||
$data['comment_field_data']['pid']['title'] = t('Parent CID');
|
||||
$data['comment_field_data']['pid']['relationship']['title'] = t('Parent comment');
|
||||
$data['comment_field_data']['pid']['relationship']['help'] = t('The parent comment');
|
||||
$data['comment_field_data']['pid']['relationship']['label'] = t('parent');
|
||||
$data['comment_field_data']['pid']['title'] = $this->t('Parent CID');
|
||||
$data['comment_field_data']['pid']['relationship']['title'] = $this->t('Parent comment');
|
||||
$data['comment_field_data']['pid']['relationship']['help'] = $this->t('The parent comment');
|
||||
$data['comment_field_data']['pid']['relationship']['label'] = $this->t('parent');
|
||||
|
||||
// Define the base group of this table. Fields that don't have a group defined
|
||||
// will go into this field by default.
|
||||
$data['comment_entity_statistics']['table']['group'] = t('Comment Statistics');
|
||||
$data['comment_entity_statistics']['table']['group'] = $this->t('Comment Statistics');
|
||||
|
||||
// Provide a relationship for each entity type except comment.
|
||||
foreach ($entities_types as $type => $entity_type) {
|
||||
|
@ -202,8 +251,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
}
|
||||
|
||||
$data['comment_entity_statistics']['last_comment_timestamp'] = array(
|
||||
'title' => t('Last comment time'),
|
||||
'help' => t('Date and time of when the last comment was posted.'),
|
||||
'title' => $this->t('Last comment time'),
|
||||
'help' => $this->t('Date and time of when the last comment was posted.'),
|
||||
'field' => array(
|
||||
'id' => 'comment_last_timestamp',
|
||||
),
|
||||
|
@ -216,8 +265,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_entity_statistics']['last_comment_name'] = array(
|
||||
'title' => t("Last comment author"),
|
||||
'help' => t('The name of the author of the last posted comment.'),
|
||||
'title' => $this->t("Last comment author"),
|
||||
'help' => $this->t('The name of the author of the last posted comment.'),
|
||||
'field' => array(
|
||||
'id' => 'comment_ces_last_comment_name',
|
||||
'no group by' => TRUE,
|
||||
|
@ -229,8 +278,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_entity_statistics']['comment_count'] = array(
|
||||
'title' => t('Comment count'),
|
||||
'help' => t('The number of comments an entity has.'),
|
||||
'title' => $this->t('Comment count'),
|
||||
'help' => $this->t('The number of comments an entity has.'),
|
||||
'field' => array(
|
||||
'id' => 'numeric',
|
||||
),
|
||||
|
@ -246,8 +295,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_entity_statistics']['last_updated'] = array(
|
||||
'title' => t('Updated/commented date'),
|
||||
'help' => t('The most recent of last comment posted or entity updated time.'),
|
||||
'title' => $this->t('Updated/commented date'),
|
||||
'help' => $this->t('The most recent of last comment posted or entity updated time.'),
|
||||
'field' => array(
|
||||
'id' => 'comment_ces_last_updated',
|
||||
'no group by' => TRUE,
|
||||
|
@ -262,28 +311,28 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_entity_statistics']['cid'] = array(
|
||||
'title' => t('Last comment CID'),
|
||||
'help' => t('Display the last comment of an entity'),
|
||||
'title' => $this->t('Last comment CID'),
|
||||
'help' => $this->t('Display the last comment of an entity'),
|
||||
'relationship' => array(
|
||||
'title' => t('Last comment'),
|
||||
'help' => t('The last comment of an entity.'),
|
||||
'group' => t('Comment'),
|
||||
'title' => $this->t('Last comment'),
|
||||
'help' => $this->t('The last comment of an entity.'),
|
||||
'group' => $this->t('Comment'),
|
||||
'base' => 'comment',
|
||||
'base field' => 'cid',
|
||||
'id' => 'standard',
|
||||
'label' => t('Last Comment'),
|
||||
'label' => $this->t('Last Comment'),
|
||||
),
|
||||
);
|
||||
|
||||
$data['comment_entity_statistics']['last_comment_uid'] = array(
|
||||
'title' => t('Last comment uid'),
|
||||
'help' => t('The User ID of the author of the last comment of an entity.'),
|
||||
'title' => $this->t('Last comment uid'),
|
||||
'help' => $this->t('The User ID of the author of the last comment of an entity.'),
|
||||
'relationship' => array(
|
||||
'title' => t('Last comment author'),
|
||||
'title' => $this->t('Last comment author'),
|
||||
'base' => 'users',
|
||||
'base field' => 'uid',
|
||||
'id' => 'standard',
|
||||
'label' => t('Last comment author'),
|
||||
'label' => $this->t('Last comment author'),
|
||||
),
|
||||
'filter' => array(
|
||||
'id' => 'numeric',
|
||||
|
@ -297,8 +346,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['comment_entity_statistics']['entity_type'] = array(
|
||||
'title' => t('Entity type'),
|
||||
'help' => t('The entity type to which the comment is a reply to.'),
|
||||
'title' => $this->t('Entity type'),
|
||||
'help' => $this->t('The entity type to which the comment is a reply to.'),
|
||||
'field' => array(
|
||||
'id' => 'standard',
|
||||
),
|
||||
|
@ -313,8 +362,8 @@ class CommentViewsData extends EntityViewsData {
|
|||
),
|
||||
);
|
||||
$data['comment_entity_statistics']['field_name'] = array(
|
||||
'title' => t('Comment field name'),
|
||||
'help' => t('The field name from which the comment originated.'),
|
||||
'title' => $this->t('Comment field name'),
|
||||
'help' => $this->t('The field name from which the comment originated.'),
|
||||
'field' => array(
|
||||
'id' => 'standard',
|
||||
),
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Controller\AdminController.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Controller\CommentController.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Controller;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
|
@ -137,7 +132,6 @@ class CommentController extends ControllerBase {
|
|||
if ($session = $request->getSession()) {
|
||||
$redirect_request->setSession($session);
|
||||
}
|
||||
// @todo: Convert the pager to use the request object.
|
||||
$request->query->set('page', $page);
|
||||
$response = $this->httpKernel->handle($redirect_request, HttpKernelInterface::SUB_REQUEST);
|
||||
if ($response instanceof CacheableResponseInterface) {
|
||||
|
@ -289,7 +283,7 @@ class CommentController extends ControllerBase {
|
|||
|
||||
$status = $entity->{$field_name}->status;
|
||||
$access = $access->andIf(AccessResult::allowedIf($status == CommentItemInterface::OPEN)
|
||||
->cacheUntilEntityChanges($entity));
|
||||
->addCacheableDependency($entity));
|
||||
|
||||
// $pid indicates that this is a reply to a comment.
|
||||
if ($pid) {
|
||||
|
@ -301,7 +295,7 @@ class CommentController extends ControllerBase {
|
|||
// Check if the parent comment is published and belongs to the entity.
|
||||
$access = $access->andIf(AccessResult::allowedIf($comment && $comment->isPublished() && $comment->getCommentedEntityId() == $entity->id()));
|
||||
if ($comment) {
|
||||
$access->cacheUntilEntityChanges($comment);
|
||||
$access->addCacheableDependency($comment);
|
||||
}
|
||||
}
|
||||
return $access;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Entity\Comment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Entity;
|
||||
|
||||
use Drupal\Component\Utility\Number;
|
||||
|
@ -204,8 +199,7 @@ class Comment extends ContentEntityBase implements CommentInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function permalink() {
|
||||
$entity = $this->getCommentedEntity();
|
||||
$uri = $entity->urlInfo();
|
||||
$uri = $this->urlInfo();
|
||||
$uri->setOption('fragment', 'comment-' . $this->id());
|
||||
return $uri;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Entity\CommentType.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Form\CommentAdminOverview.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Form;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Form\CommentTypeDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Form;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Form\ConfirmDeleteMultiple.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Form;
|
||||
|
||||
use Drupal\comment\CommentStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Form\DeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Action\PublishComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Action\SaveComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Action\UnpublishByKeywordComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Component\Utility\Tags;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Action\UnpublishComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\EntityReferenceSelection\CommentSelection.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\EntityReferenceSelection;
|
||||
|
||||
use Drupal\Core\Database\Query\SelectInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Field\FieldFormatter\AuthorNameFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
@ -16,6 +11,7 @@ use Drupal\Core\Session\AccountInterface;
|
|||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -79,6 +75,11 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
|
|||
*/
|
||||
protected $entityFormBuilder;
|
||||
|
||||
/**
|
||||
* @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch
|
||||
*/
|
||||
protected $routeMatch;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -93,7 +94,8 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
|
|||
$configuration['third_party_settings'],
|
||||
$container->get('current_user'),
|
||||
$container->get('entity.manager'),
|
||||
$container->get('entity.form_builder')
|
||||
$container->get('entity.form_builder'),
|
||||
$container->get('current_route_match')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -120,14 +122,17 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
|
|||
* The entity manager
|
||||
* @param \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder
|
||||
* The entity form builder.
|
||||
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
||||
* The route match object.
|
||||
*/
|
||||
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, EntityManagerInterface $entity_manager, EntityFormBuilderInterface $entity_form_builder) {
|
||||
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, EntityManagerInterface $entity_manager, EntityFormBuilderInterface $entity_form_builder, RouteMatchInterface $route_match) {
|
||||
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
|
||||
$this->viewBuilder = $entity_manager->getViewBuilder('comment');
|
||||
$this->storage = $entity_manager->getStorage('comment');
|
||||
$this->currentUser = $current_user;
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->entityFormBuilder = $entity_form_builder;
|
||||
$this->routeMatch = $route_match;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,6 +169,12 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
|
|||
if ($comments) {
|
||||
$build = $this->viewBuilder->viewMultiple($comments);
|
||||
$build['pager']['#type'] = 'pager';
|
||||
// CommentController::commentPermalink() calculates the page number
|
||||
// where a specific comment appears and does a subrequest pointing to
|
||||
// that page, we need to pass that subrequest route to our pager to
|
||||
// keep the pager working.
|
||||
$build['pager']['#route_name'] = $this->routeMatch->getRouteObject();
|
||||
$build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
|
||||
if ($this->getSetting('pager_id')) {
|
||||
$build['pager']['#element'] = $this->getSetting('pager_id');
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Field\FieldType\CommentItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
@ -12,7 +7,6 @@ use Drupal\comment\Entity\CommentType;
|
|||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\TypedData\DataDefinition;
|
||||
use Drupal\Core\Field\FieldItemBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Field\FieldType\CommentItemInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Field\FieldType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Field\FieldWidget\CommentWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Menu\LocalTask\UnapprovedComments.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Menu\LocalTask;
|
||||
|
||||
use Drupal\comment\CommentStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Validation\Constraint;
|
||||
|
||||
use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraintValidator.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\Validation\Constraint;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\destination\EntityComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\destination;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
@ -12,8 +7,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
|
|||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
use Drupal\Core\Field\FieldTypePluginManagerInterface;
|
||||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\MigrateException;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
|
||||
use Drupal\migrate\Row;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\destination\EntityCommentType.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\destination;
|
||||
|
||||
use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\source\d6\Comment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\source\d6\CommentVariable.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
|
|
5
core/modules/comment/src/Plugin/migrate/source/d7/Comment.php
Executable file → Normal file
5
core/modules/comment/src/Plugin/migrate/source/d7/Comment.php
Executable file → Normal file
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\source\d7\Comment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\migrate\source\d7\CommentType.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\argument\UserUid.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\Depth.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\views\Plugin\views\field\Field;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\EntityLink.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\LastTimestamp.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\views\Plugin\views\field\Date;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\LinkApprove.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\LinkReply.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\NodeNewComments.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\views\Plugin\views\field\NumericField;
|
||||
use Drupal\views\Plugin\views\display\DisplayPluginBase;
|
||||
use Drupal\views\ResultRow;
|
||||
|
@ -162,10 +158,10 @@ class NodeNewComments extends NumericField {
|
|||
protected function renderLink($data, ResultRow $values) {
|
||||
if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
|
||||
$node_type = $this->getValue($values, 'type');
|
||||
$node = entity_create('node', array(
|
||||
$node = Node::create([
|
||||
'nid' => $this->getValue($values, 'nid'),
|
||||
'type' => $node_type,
|
||||
));
|
||||
]);
|
||||
// Because there is no support for selecting a specific comment field to
|
||||
// reference, we arbitrarily use the first such field name we find.
|
||||
// @todo Provide a means for selecting the comment field.
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\StatisticsLastCommentName.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\user\Entity\User;
|
||||
use Drupal\views\Plugin\views\field\FieldPluginBase;
|
||||
use Drupal\views\ResultRow;
|
||||
|
||||
|
@ -67,7 +63,7 @@ class StatisticsLastCommentName extends FieldPluginBase {
|
|||
*/
|
||||
public function render(ResultRow $values) {
|
||||
if (!empty($this->options['link_to_user'])) {
|
||||
$account = entity_create('user');
|
||||
$account = User::create();
|
||||
$account->name = $this->getValue($values);
|
||||
$account->uid = $values->{$this->uid};
|
||||
$username = array(
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\field\StatisticsLastUpdated.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\views\Plugin\views\field\Date;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\filter\NodeComment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\filter;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\filter\StatisticsLastUpdated.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\filter;
|
||||
|
||||
use Drupal\views\Plugin\views\filter\Date;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\filter\UserUid.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\filter;
|
||||
|
||||
use Drupal\views\Plugin\views\filter\FilterPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\row\Rss.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\row;
|
||||
|
||||
use Drupal\views\Plugin\views\row\RssPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\sort\StatisticsLastCommentName.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\sort;
|
||||
|
||||
use Drupal\views\Plugin\views\sort\SortPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\sort\StatisticsLastUpdated.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\sort;
|
||||
|
||||
use Drupal\views\Plugin\views\sort\Date;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\sort\Thread.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\sort;
|
||||
|
||||
use Drupal\views\Plugin\views\sort\SortPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Plugin\views\wizard\Comment.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Plugin\views\wizard;
|
||||
|
||||
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentActionsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\system\Entity\Action;
|
||||
|
||||
/**
|
||||
* Tests actions provided by the Comment module.
|
||||
|
@ -50,7 +46,7 @@ class CommentActionsTest extends CommentTestBase {
|
|||
$this->drupalLogin($this->adminUser);
|
||||
$keyword_1 = $this->randomMachineName();
|
||||
$keyword_2 = $this->randomMachineName();
|
||||
$action = entity_create('action', array(
|
||||
$action = Action::create(array(
|
||||
'id' => 'comment_unpublish_by_keyword_action',
|
||||
'label' => $this->randomMachineName(),
|
||||
'type' => 'comment',
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentAdminTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\user\RoleInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Tests comment approval functionality.
|
||||
|
@ -50,7 +46,7 @@ class CommentAdminTest extends CommentTestBase {
|
|||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$anonymous_comment4 = $this->getUnapprovedComment($subject);
|
||||
$anonymous_comment4 = entity_create('comment', array(
|
||||
$anonymous_comment4 = Comment::create(array(
|
||||
'cid' => $anonymous_comment4,
|
||||
'subject' => $subject,
|
||||
'comment_body' => $body,
|
||||
|
@ -127,7 +123,7 @@ class CommentAdminTest extends CommentTestBase {
|
|||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$anonymous_comment4 = $this->getUnapprovedComment($subject);
|
||||
$anonymous_comment4 = entity_create('comment', array(
|
||||
$anonymous_comment4 = Comment::create(array(
|
||||
'cid' => $anonymous_comment4,
|
||||
'subject' => $subject,
|
||||
'comment_body' => $body,
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentAnonymousTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\user\RoleInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentBlockTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentBookTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Tests visibility of comments on book pages.
|
||||
|
@ -37,17 +34,17 @@ class CommentBookTest extends WebTestBase {
|
|||
* Tests comments in book export.
|
||||
*/
|
||||
public function testBookCommentPrint() {
|
||||
$book_node = entity_create('node', array(
|
||||
$book_node = Node::create([
|
||||
'type' => 'book',
|
||||
'title' => 'Book title',
|
||||
'body' => 'Book body',
|
||||
));
|
||||
]);
|
||||
$book_node->book['bid'] = 'new';
|
||||
$book_node->save();
|
||||
|
||||
$comment_subject = $this->randomMachineName(8);
|
||||
$comment_body = $this->randomMachineName(8);
|
||||
$comment = entity_create('comment', array(
|
||||
$comment = Comment::create(array(
|
||||
'subject' => $comment_subject,
|
||||
'comment_body' => $comment_body,
|
||||
'entity_id' => $book_node->id(),
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentCSSTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\user\RoleInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Tests CSS classes on comments.
|
||||
|
@ -47,7 +43,7 @@ class CommentCSSTest extends CommentTestBase {
|
|||
|
||||
// Add a comment.
|
||||
/** @var \Drupal\comment\CommentInterface $comment */
|
||||
$comment = entity_create('comment', array(
|
||||
$comment = Comment::create(array(
|
||||
'entity_id' => $node->id(),
|
||||
'entity_type' => 'node',
|
||||
'field_name' => 'comment',
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentCacheTagsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\system\Tests\Entity\EntityWithUriCacheTagsTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
@ -70,14 +66,14 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
|
|||
$field->save();
|
||||
|
||||
// Create a "Camelids" test entity that the comment will be assigned to.
|
||||
$this->entityTestCamelid = entity_create('entity_test', array(
|
||||
$this->entityTestCamelid = EntityTest::create(array(
|
||||
'name' => 'Camelids',
|
||||
'type' => 'bar',
|
||||
));
|
||||
$this->entityTestCamelid->save();
|
||||
|
||||
// Create a "Llama" comment.
|
||||
$comment = entity_create('comment', array(
|
||||
$comment = Comment::create(array(
|
||||
'subject' => 'Llama',
|
||||
'comment_body' => array(
|
||||
'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
|
||||
|
@ -101,7 +97,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
|
|||
$this->verifyPageCache($this->entityTestCamelid->urlInfo(), 'HIT');
|
||||
|
||||
// Create a "Hippopotamus" comment.
|
||||
$this->entityTestHippopotamidae = entity_create('entity_test', array(
|
||||
$this->entityTestHippopotamidae = EntityTest::create(array(
|
||||
'name' => 'Hippopotamus',
|
||||
'type' => 'bar',
|
||||
));
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentFieldsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentInterfaceTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
@ -80,6 +75,12 @@ class CommentInterfaceTest extends CommentTestBase {
|
|||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($subject_text, 'Individual comment subject found.');
|
||||
$this->assertText($comment_text, 'Individual comment body found.');
|
||||
$arguments = [
|
||||
':link' => base_path() . 'comment/' . $comment->id() . '#comment-' . $comment->id(),
|
||||
];
|
||||
$pattern_permalink = '//footer[contains(@class,"comment__meta")]/a[contains(@href,:link) and text()="Permalink"]';
|
||||
$permalink = $this->xpath($pattern_permalink, $arguments);
|
||||
$this->assertTrue(!empty($permalink), 'Permalink link found.');
|
||||
|
||||
// Set comments to have subject and preview to optional.
|
||||
$this->drupalLogout();
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentLanguageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentLinksAlterTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentLinksTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\user\RoleInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Basic comment links tests to ensure markup present.
|
||||
|
@ -59,7 +55,7 @@ class CommentLinksTest extends CommentTestBase {
|
|||
|
||||
// Create a comment via CRUD API functionality, since
|
||||
// $this->postComment() relies on actual user permissions.
|
||||
$comment = entity_create('comment', array(
|
||||
$comment = Comment::create(array(
|
||||
'cid' => NULL,
|
||||
'entity_id' => $this->node->id(),
|
||||
'entity_type' => 'node',
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentNewIndicatorTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Tests the 'new' indicator posted on comments.
|
||||
|
@ -85,7 +81,7 @@ class CommentNewIndicatorTest extends CommentTestBase {
|
|||
// Create a new comment. This helper function may be run with different
|
||||
// comment settings so use $comment->save() to avoid complex setup.
|
||||
/** @var \Drupal\comment\CommentInterface $comment */
|
||||
$comment = entity_create('comment', array(
|
||||
$comment = Comment::create(array(
|
||||
'cid' => NULL,
|
||||
'entity_id' => $this->node->id(),
|
||||
'entity_type' => 'node',
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentNodeAccessTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentNodeChangesTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentNonNodeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\comment\Entity\CommentType;
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field_ui\Tests\FieldUiTestTrait;
|
||||
|
@ -54,7 +50,7 @@ class CommentNonNodeTest extends WebTestBase {
|
|||
|
||||
// Create a bundle for entity_test.
|
||||
entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test');
|
||||
entity_create('comment_type', array(
|
||||
CommentType::create(array(
|
||||
'id' => 'comment',
|
||||
'label' => 'Comment settings',
|
||||
'description' => 'Comment settings',
|
||||
|
@ -92,7 +88,7 @@ class CommentNonNodeTest extends WebTestBase {
|
|||
// Create a test entity.
|
||||
$random_label = $this->randomMachineName();
|
||||
$data = array('type' => 'entity_test', 'name' => $random_label);
|
||||
$this->entity = entity_create('entity_test', $data);
|
||||
$this->entity = EntityTest::create($data);
|
||||
$this->entity->save();
|
||||
}
|
||||
|
||||
|
@ -433,7 +429,7 @@ class CommentNonNodeTest extends WebTestBase {
|
|||
// Test the new entity commenting inherits default.
|
||||
$random_label = $this->randomMachineName();
|
||||
$data = array('bundle' => 'entity_test', 'name' => $random_label);
|
||||
$new_entity = entity_create('entity_test', $data);
|
||||
$new_entity = EntityTest::create($data);
|
||||
$new_entity->save();
|
||||
$this->drupalGet('entity_test/manage/' . $new_entity->id() . '/edit');
|
||||
$this->assertNoFieldChecked('edit-field-foobar-0-status-1');
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentPagerTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
@ -173,9 +168,9 @@ class CommentPagerTest extends CommentTestBase {
|
|||
/**
|
||||
* Asserts that the comments are displayed in the correct order.
|
||||
*
|
||||
* @param $comments
|
||||
* And array of comments.
|
||||
* @param $expected_order
|
||||
* @param \Drupal\comment\CommentInterface[] $comments
|
||||
* An array of comments, must be of the type CommentInterface.
|
||||
* @param array $expected_order
|
||||
* An array of keys from $comments describing the expected order.
|
||||
*/
|
||||
function assertCommentOrder(array $comments, array $expected_order) {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentPreviewTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
|
@ -54,7 +49,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
|
||||
\Drupal::state()->set('user_hooks_test_user_format_name_alter_safe', TRUE);
|
||||
$this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
|
||||
$this->assertTrue(SafeMarkup::isSafe($this->webUser->getDisplayName()), 'Username is marked safe');
|
||||
$this->assertTrue($this->webUser->getDisplayName() instanceof MarkupInterface, 'Username is marked safe');
|
||||
$this->assertNoEscaped('<em>' . $this->webUser->id() . '</em>');
|
||||
$this->assertRaw('<em>' . $this->webUser->id() . '</em>');
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentRssTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\CommentStatisticsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue