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
|
@ -110,3 +110,20 @@ function comment_schema() {
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup updates-8.0.0-rc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Clear caches to fix Comment entity list builder and operations Views field.
|
||||
*/
|
||||
function comment_update_8001() {
|
||||
// Empty update to cause a cache flush to rebuild comment entity handler
|
||||
// information, so that comment operation links work.
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-rc".
|
||||
*/
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- comment
|
||||
- user
|
||||
id: test_comment_operations
|
||||
label: test_comment_operations
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: comment_field_data
|
||||
base_field: cid
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
id: default
|
||||
display_title: Master
|
||||
position: 0
|
||||
display_options:
|
||||
access:
|
||||
type: perm
|
||||
options:
|
||||
perm: 'administer comments'
|
||||
cache:
|
||||
type: tag
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
options:
|
||||
disable_sql_rewrite: false
|
||||
distinct: false
|
||||
replica: false
|
||||
query_comment: ''
|
||||
query_tags: { }
|
||||
exposed_form:
|
||||
type: basic
|
||||
options:
|
||||
submit_button: Apply
|
||||
reset_button: false
|
||||
reset_button_label: Reset
|
||||
exposed_sorts_label: 'Sort by'
|
||||
expose_sort_order: true
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
pager:
|
||||
type: full
|
||||
options:
|
||||
items_per_page: 10
|
||||
offset: 0
|
||||
id: 0
|
||||
total_pages: null
|
||||
expose:
|
||||
items_per_page: false
|
||||
items_per_page_label: 'Items per page'
|
||||
items_per_page_options: '5, 10, 25, 50'
|
||||
items_per_page_options_all: false
|
||||
items_per_page_options_all_label: '- All -'
|
||||
offset: false
|
||||
offset_label: Offset
|
||||
tags:
|
||||
previous: '‹ Previous'
|
||||
next: 'Next ›'
|
||||
first: '« First'
|
||||
last: 'Last »'
|
||||
quantity: 9
|
||||
style:
|
||||
type: table
|
||||
options:
|
||||
grouping: { }
|
||||
row_class: ''
|
||||
default_row_class: true
|
||||
override: true
|
||||
sticky: false
|
||||
caption: ''
|
||||
summary: ''
|
||||
description: ''
|
||||
columns:
|
||||
subject: subject
|
||||
operations: operations
|
||||
info:
|
||||
subject:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
operations:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
default: '-1'
|
||||
empty_table: false
|
||||
row:
|
||||
type: fields
|
||||
options:
|
||||
inline: { }
|
||||
separator: ''
|
||||
hide_empty: false
|
||||
default_field_elements: true
|
||||
relationships: { }
|
||||
fields:
|
||||
subject:
|
||||
id: subject
|
||||
table: comment_field_data
|
||||
field: subject
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Subject
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: false
|
||||
ellipsis: false
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: true
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: comment
|
||||
entity_field: subject
|
||||
plugin_id: field
|
||||
operations:
|
||||
id: operations
|
||||
table: comment
|
||||
field: operations
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Operations
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
destination: true
|
||||
entity_type: comment
|
||||
plugin_id: entity_operations
|
||||
filters: { }
|
||||
sorts: { }
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url.query_args
|
||||
- user.permissions
|
||||
tags: { }
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
display_title: Page
|
||||
position: 1
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: test-comment-operations
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url.query_args
|
||||
- user.permissions
|
||||
tags: { }
|
Reference in a new issue