Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -66,7 +66,7 @@ class CommentForm extends ContentEntityForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityForm::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, FormStateInterface $form_state) {
|
||||
/** @var \Drupal\comment\CommentInterface $comment */
|
||||
|
@ -227,7 +227,7 @@ class CommentForm extends ContentEntityForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityForm::actions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function actions(array $form, FormStateInterface $form_state) {
|
||||
$element = parent::actions($form, $form_state);
|
||||
|
@ -348,7 +348,7 @@ class CommentForm extends ContentEntityForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityForm::save().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
$comment = $this->entity;
|
||||
|
|
|
@ -42,10 +42,10 @@ class CommentStorage extends SqlContentEntityStorage implements CommentStorageIn
|
|||
* The database connection to be used.
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
|
||||
* Cache backend instance to use.
|
||||
* @param \Drupal\Core\Session\AccountInterface $current_user
|
||||
* The current user.
|
||||
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
|
||||
* Cache backend instance to use.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
*/
|
||||
|
|
|
@ -113,11 +113,11 @@ class CommentController extends ControllerBase {
|
|||
* @param \Drupal\comment\CommentInterface $comment
|
||||
* A comment entity.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* The comment listing set to the page on which the comment appears.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
*/
|
||||
public function commentPermalink(Request $request, CommentInterface $comment) {
|
||||
if ($entity = $comment->getCommentedEntity()) {
|
||||
|
@ -172,10 +172,10 @@ class CommentController extends ControllerBase {
|
|||
* @param \Drupal\Core\Entity\EntityInterface $node
|
||||
* The node object identified by the legacy URL.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* Redirects user to new url.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public function redirectNode(EntityInterface $node) {
|
||||
$fields = $this->commentManager->getFields('node');
|
||||
|
@ -208,17 +208,17 @@ class CommentController extends ControllerBase {
|
|||
* (optional) Some comments are replies to other comments. In those cases,
|
||||
* $pid is the parent comment's comment ID. Defaults to NULL.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @return array|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* An associative array containing:
|
||||
* - An array for rendering the entity or parent comment.
|
||||
* - comment_entity: If the comment is a reply to the entity.
|
||||
* - comment_parent: If the comment is a reply to another comment.
|
||||
* - comment_form: The comment form as a renderable array.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public function getReplyForm(Request $request, EntityInterface $entity, $field_name, $pid = NULL) {
|
||||
$account = $this->currentUser();
|
||||
$uri = $entity->urlInfo()->setAbsolute();
|
||||
$build = array();
|
||||
|
||||
// The user is not just previewing a comment.
|
||||
|
@ -270,9 +270,10 @@ class CommentController extends ControllerBase {
|
|||
* (optional) Some comments are replies to other comments. In those cases,
|
||||
* $pid is the parent comment's comment ID. Defaults to NULL.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* An access result
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public function replyFormAccess(EntityInterface $entity, $field_name, $pid = NULL) {
|
||||
// Check if entity and field exists.
|
||||
|
@ -312,10 +313,11 @@ class CommentController extends ControllerBase {
|
|||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The request of the page.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse
|
||||
* The JSON response.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public function renderNewCommentsNodeLinks(Request $request) {
|
||||
if ($this->currentUser()->isAnonymous()) {
|
||||
|
|
|
@ -30,6 +30,7 @@ use Drupal\user\UserInterface;
|
|||
* "storage" = "Drupal\comment\CommentStorage",
|
||||
* "storage_schema" = "Drupal\comment\CommentStorageSchema",
|
||||
* "access" = "Drupal\comment\CommentAccessControlHandler",
|
||||
* "list_builder" = "Drupal\Core\Entity\EntityListBuilder",
|
||||
* "view_builder" = "Drupal\comment\CommentViewBuilder",
|
||||
* "views_data" = "Drupal\comment\CommentViewsData",
|
||||
* "form" = {
|
||||
|
|
|
@ -22,7 +22,7 @@ use Drupal\views\ViewExecutable;
|
|||
class LastTimestamp extends Date {
|
||||
|
||||
/**
|
||||
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
|
|
|
@ -84,8 +84,6 @@ class Rss extends RssPluginBase {
|
|||
return;
|
||||
}
|
||||
|
||||
$description_build = [];
|
||||
|
||||
$comment->link = $comment->url('canonical', array('absolute' => TRUE));
|
||||
$comment->rss_namespaces = array();
|
||||
$comment->rss_elements = array(
|
||||
|
@ -113,13 +111,11 @@ class Rss extends RssPluginBase {
|
|||
$this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces);
|
||||
}
|
||||
|
||||
$item = new \stdClass();
|
||||
if ($view_mode != 'title') {
|
||||
// We render comment contents.
|
||||
$description_build = $build;
|
||||
$item->description = $build;
|
||||
}
|
||||
|
||||
$item = new \stdClass();
|
||||
$item->description = $description_build;
|
||||
$item->title = $comment->label();
|
||||
$item->link = $comment->link;
|
||||
// Provide a reference so that the render call in
|
||||
|
|
|
@ -53,7 +53,7 @@ class Comment extends WizardPluginBase {
|
|||
);
|
||||
|
||||
/**
|
||||
* Overrides Drupal\views\Plugin\views\wizard\WizardPluginBase::rowStyleOptions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function rowStyleOptions() {
|
||||
$options = array();
|
||||
|
@ -63,7 +63,7 @@ class Comment extends WizardPluginBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplayOptions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function defaultDisplayOptions() {
|
||||
$display_options = parent::defaultDisplayOptions();
|
||||
|
|
|
@ -63,7 +63,7 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITestBase::setupBundle().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setupBundle() {
|
||||
parent::setupBundle();
|
||||
|
@ -80,14 +80,14 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITestBase::getTranslatorPermission().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getTranslatorPermissions() {
|
||||
return array_merge(parent::getTranslatorPermissions(), array('post comments', 'administer comments', 'access comments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITestBase::createEntity().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createEntity($values, $langcode, $comment_type = 'comment_article') {
|
||||
if ($comment_type == 'comment_article') {
|
||||
|
@ -114,7 +114,7 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITestBase::getNewEntityValues().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getNewEntityValues($langcode) {
|
||||
// Comment subject is not translatable hence we use a fixed value.
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\comment\Tests\Views\CommentOperationsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\comment\Tests\Views;
|
||||
|
||||
/**
|
||||
* Tests comment operations.
|
||||
*
|
||||
* @group comment
|
||||
*/
|
||||
class CommentOperationsTest extends CommentTestBase {
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = ['test_comment_operations'];
|
||||
|
||||
/**
|
||||
* Test the operations field plugin.
|
||||
*/
|
||||
public function testCommentOperations() {
|
||||
$admin_account = $this->drupalCreateUser(['administer comments']);
|
||||
$this->drupalLogin($admin_account);
|
||||
$this->drupalGet('test-comment-operations');
|
||||
$this->assertResponse(200);
|
||||
$operation = $this->cssSelect('.views-field-operations li.edit a');
|
||||
$this->assertEqual(count($operation), 1, 'Found edit operation for comment.');
|
||||
$operation = $this->cssSelect('.views-field-operations li.delete a');
|
||||
$this->assertEqual(count($operation), 1, 'Found delete operation for comment.');
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue