From b0e86af1cbad513eec03ef00b3fd19ad37dfcd7c Mon Sep 17 00:00:00 2001 From: tkuldeep Date: Thu, 15 May 2014 17:28:22 +0530 Subject: [PATCH 1/2] Patch is applied after my chnages..#103 Signed-off-by: tkuldeep --- core/modules/comment/comment.routing.yml | 4 +- .../comment/config/install/views.view.comment.yml | 1218 +++++++++++++++++ .../Drupal/comment/Form/CommentAdminOverview.php | 61 +- .../Drupal/comment/Form/ConfirmDeleteMultiple.php | 40 +- .../Drupal/comment/Plugin/views/field/LinkEdit.php | 2 +- .../lib/Drupal/comment/Tests/CommentAdminTest.php | 2 +- .../Drupal/comment/Tests/CommentNonNodeTest.php | 2 +- .../lib/Drupal/comment/Tests/CommentTestBase.php | 2 +- .../node/config/install/views.view.content.yml | 1422 ++++++++++++++------ .../Tests/Plugin/views/field/NodeBulkFormTest.php | 3 +- .../Drupal/system/Plugin/views/field/BulkForm.php | 24 +- .../Tests/Plugin/views/field/UserBulkFormTest.php | 3 +- .../lib/Drupal/views/Tests/DefaultViewsTest.php | 4 - 13 files changed, 2352 insertions(+), 435 deletions(-) create mode 100644 core/modules/comment/config/install/views.view.comment.yml diff --git a/core/modules/comment/comment.routing.yml b/core/modules/comment/comment.routing.yml index 1a6ac59..d359031 100644 --- a/core/modules/comment/comment.routing.yml +++ b/core/modules/comment/comment.routing.yml @@ -1,8 +1,8 @@ comment.admin: path: '/admin/content/comment' defaults: + _form: 'Drupal\comment\Form\CommentAdminOverview' _title: 'Comments' - _content: '\Drupal\comment\Controller\AdminController::adminPage' type: 'new' requirements: _permission: 'administer comments' @@ -11,7 +11,7 @@ comment.admin_approval: path: '/admin/content/comment/approval' defaults: _title: 'Unapproved comments' - _content: '\Drupal\comment\Controller\AdminController::adminPage' + _form: 'Drupal\comment\Form\CommentAdminOverview' type: 'approval' requirements: _permission: 'administer comments' diff --git a/core/modules/comment/config/install/views.view.comment.yml b/core/modules/comment/config/install/views.view.comment.yml new file mode 100644 index 0000000..bdb8fe5 --- /dev/null +++ b/core/modules/comment/config/install/views.view.comment.yml @@ -0,0 +1,1218 @@ +base_field: cid +base_table: comment +core: 8.x +description: 'Find and manage comments.' +status: true +display: + default: + display_plugin: default + id: default + display_title: Master + position: 1 + display_options: + access: + type: perm + options: + perm: 'administer comments' + cache: + type: none + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + slave: false + query_comment: false + 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: 50 + 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, 20, 40, 60' + 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 + row_class_special: true + override: true + sticky: false + caption: '' + summary: '' + description: '' + columns: + subject: subject + name: name + title: title + edit_comment: edit_comment + dropbutton: dropbutton + translation_link: translation_link + changed: changed + info: + subject: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + name: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: priority-medium + title: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: priority-low + edit_comment: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + dropbutton: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + translation_link: + align: '' + separator: '' + empty_column: false + responsive: '' + changed: + sortable: true + default_sort_order: desc + align: '' + separator: '' + empty_column: false + responsive: priority-low + default: changed + empty_table: false + row: + type: fields + relationships: + node: + id: node + table: comment + field: node + required: 1 + relationship: none + group_type: group + admin_label: Content + fields: + comment_bulk_form: + id: comment_bulk_form + table: comment + field: comment_bulk_form + relationship: none + group_type: group + admin_label: '' + label: '' + 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: '' + 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 + action_title: 'Update Options' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_unpublish_action: comment_unpublish_action + plugin_id: comment_bulk_form + provider: comment + subject: + id: subject + table: comment + 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: '' + 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 + link_to_comment: 1 + link_to_entity: 0 + provider: comment + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_user: 1 + plugin_id: comment_username + provider: comment + title: + id: title + table: node_field_data + field: title + relationship: node + group_type: group + admin_label: '' + label: 'Posted in' + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_node: 1 + plugin_id: node + provider: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + provider: views + edit_comment: + id: edit_comment + table: comment + field: edit_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: edit + link_to_entity: 0 + destination: 0 + plugin_id: comment_link_edit + provider: comment + delete_comment: + id: delete_comment + table: comment + field: delete_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: delete + link_to_entity: 0 + plugin_id: comment_link_delete + provider: comment + translation_link: + id: translation_link + table: comment + field: translation_link + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: translate + plugin_id: content_translation_link + provider: content_translation + dropbutton: + id: dropbutton + table: views + field: dropbutton + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + fields: + edit_comment: edit_comment + delete_comment: delete_comment + translation_link: translation_link + action_bulk_form: 0 + subject: 0 + name: 0 + title: 0 + changed: 0 + destination: 1 + plugin_id: dropbutton + provider: views + filters: + status: + value: '1' + table: comment + field: status + provider: comment + id: status + expose: + operator: '' + group: '1' + sorts: + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + order: DESC + exposed: false + expose: + label: '' + granularity: second + plugin_id: date + provider: views + title: Comment + header: { } + footer: { } + empty: + area: + id: area + table: views + field: area + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: false + content: 'No comments available.' + format: basic_html + plugin_id: text + provider: views + arguments: { } + page_1: + display_plugin: page + id: page_1 + display_title: 'Published Comments' + position: 1 + display_options: + path: admin/content/comment + menu: + type: tab + title: Comments + description: 'Comments published' + name: admin + weight: 0 + context: '0' + display_description: '' + page_2: + display_plugin: page + id: page_2 + display_title: 'Unapproved Comments' + position: 2 + display_options: + path: admin/content/comment/approval + menu: + type: tab + title: 'Unapproved comments' + description: 'Comments unapproved' + name: admin + weight: 1 + context: '0' + display_description: '' + filters: + status: + id: status + table: comment + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '0' + group: '1' + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: 0 + default_group: All + default_group_multiple: { } + group_items: { } + provider: comment + defaults: + filters: false + filter_groups: false + fields: false + filter_groups: + operator: AND + groups: + 1: AND + fields: + comment_bulk_form: + id: comment_bulk_form + table: comment + field: comment_bulk_form + relationship: none + group_type: group + admin_label: '' + label: '' + 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: '' + 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 + action_title: 'Update Options' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_publish_action: comment_publish_action + plugin_id: comment_bulk_form + provider: comment + subject: + id: subject + table: comment + 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: '' + 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 + link_to_comment: 1 + link_to_entity: 0 + provider: comment + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_user: 1 + plugin_id: comment_username + provider: comment + title: + id: title + table: node_field_data + field: title + relationship: node + group_type: group + admin_label: '' + label: 'Posted in' + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_node: 1 + plugin_id: node + provider: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + provider: views + edit_comment: + id: edit_comment + table: comment + field: edit_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: edit + link_to_entity: 0 + destination: 0 + plugin_id: comment_link_edit + provider: comment + delete_comment: + id: delete_comment + table: comment + field: delete_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: delete + link_to_entity: 0 + plugin_id: comment_link_delete + provider: comment + translation_link: + id: translation_link + table: comment + field: translation_link + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: translate + plugin_id: content_translation_link + provider: content_translation + dropbutton: + id: dropbutton + table: views + field: dropbutton + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + fields: + edit_comment: edit_comment + delete_comment: delete_comment + translation_link: translation_link + action_bulk_form: 0 + subject: 0 + name: 0 + title: 0 + changed: 0 + destination: 1 + plugin_id: dropbutton + provider: views +label: Comment +module: views +id: comment +tag: '' +langcode: en diff --git a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php index a4db950..a30606e 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php +++ b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php @@ -16,6 +16,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\user\TempStoreFactory; /** * Provides the comments overview administration form. @@ -51,6 +52,13 @@ class CommentAdminOverview extends FormBase { protected $moduleHandler; /** + * The tempstore factory. + * + * @var \Drupal\user\TempStoreFactory + */ + protected $tempStoreFactory; + + /** * Creates a CommentAdminOverview form. * * @param \Drupal\Core\Entity\EntityManager $entity_manager @@ -61,12 +69,16 @@ class CommentAdminOverview extends FormBase { * The date service. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. + * @param \Drupal\user\TempStoreFactory $temp_store_factory + * The tempstore factory. */ - public function __construct(EntityManager $entity_manager, CommentStorageInterface $comment_storage, Date $date, ModuleHandlerInterface $module_handler) { + public function __construct(EntityManager $entity_manager, CommentStorageInterface $comment_storage, Date $date, + ModuleHandlerInterface $module_handler, TempStoreFactory $temp_store_factory) { $this->entityManager = $entity_manager; $this->commentStorage = $comment_storage; $this->date = $date; $this->moduleHandler = $module_handler; + $this->tempStoreFactory = $temp_store_factory; } /** @@ -77,7 +89,8 @@ public static function create(ContainerInterface $container) { $container->get('entity.manager'), $container->get('entity.manager')->getStorage('comment'), $container->get('date'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('user.tempstore') ); } @@ -266,25 +279,33 @@ public function submitForm(array &$form, array &$form_state) { $operation = $form_state['values']['operation']; $cids = $form_state['values']['comments']; - foreach ($cids as $cid) { - // Delete operation handled in \Drupal\comment\Form\ConfirmDeleteMultiple - // see \Drupal\comment\Controller\AdminController::adminPage(). - if ($operation == 'unpublish') { - $comment = $this->commentStorage->load($cid); - $comment->setPublished(FALSE); - $comment->save(); - } - elseif ($operation == 'publish') { - $comment = $this->commentStorage->load($cid); - $comment->setPublished(TRUE); - $comment->save(); - } + if ($operation != 'delete') { + foreach ($cids as $cid) { + if ($operation == 'unpublish') { + $comment = $this->commentStorage->load($cid); + $comment->status->value = CommentInterface::NOT_PUBLISHED; + $comment->save(); + } + elseif ($operation == 'publish') { + $comment = $this->commentStorage->load($cid); + $comment->status->value = CommentInterface::PUBLISHED; + $comment->save(); + } + } + drupal_set_message($this->t('The update has been performed.')); + $form_state['redirect_route'] = array( + 'route_name' => 'comment.admin', + ); + Cache::invalidateTags(array('content' => TRUE)); } - drupal_set_message($this->t('The update has been performed.')); - $form_state['redirect_route'] = array( - 'route_name' => 'comment.admin', - ); - Cache::invalidateTags(array('content' => TRUE)); + else { + $this->tempStoreFactory + ->get('comment_multiple_delete_confirm') + ->set(\Drupal::currentUser()->id(), $this->commentStorage->loadMultiple($cids)); + $form_state['redirect_route'] = array( + 'route_name' => 'comment.multiple_delete_confirm', + ); + } } } diff --git a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php index 4598bd0..85d4c67 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php +++ b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php @@ -33,13 +33,23 @@ class ConfirmDeleteMultiple extends ConfirmFormBase { protected $comments; /** + * The tempstore factory. + * + * @var \Drupal\user\TempStoreFactory + */ + protected $tempStoreFactory; + + /** * Creates an new ConfirmDeleteMultiple form. * * @param \Drupal\comment\CommentStorageInterface $comment_storage * The comment storage. + * @param \Drupal\user\TempStoreFactory $temp_store_factory + * The tempstore factory. */ - public function __construct(CommentStorageInterface $comment_storage) { + public function __construct(CommentStorageInterface $comment_storage, TempStoreFactory $temp_store_factory) { $this->commentStorage = $comment_storage; + $this->tempStoreFactory = $temp_store_factory; } /** @@ -47,7 +57,8 @@ public function __construct(CommentStorageInterface $comment_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('comment') + $container->get('entity.manager')->getStorage('comment'), + $container->get('user.tempstore') ); } @@ -78,7 +89,7 @@ public function getCancelRoute() { * {@inheritdoc} */ public function getConfirmText() { - return $this->t('Delete comments'); + return $this->t('Delete'); } /** @@ -86,15 +97,17 @@ public function getConfirmText() { */ public function buildForm(array $form, array &$form_state) { $edit = $form_state['input']; + $this->comments = $this->tempStoreFactory->get('comment_multiple_delete_confirm')->get(\Drupal::currentUser()->id()); + if (empty($this->comments)) { + return new RedirectResponse($this->urlGenerator()->generate('comment.admin')); + } $form['comments'] = array( '#prefix' => '', '#tree' => TRUE, ); - // array_filter() returns only elements with actual values. - $comment_counter = 0; - $this->comments = $this->commentStorage->loadMultiple(array_keys(array_filter($edit['comments']))); + foreach ($this->comments as $comment) { $cid = $comment->id(); $form['comments'][$cid] = array( @@ -103,15 +116,9 @@ public function buildForm(array $form, array &$form_state) { '#prefix' => '
  • ', '#suffix' => String::checkPlain($comment->label()) . '
  • ' ); - $comment_counter++; } $form['operation'] = array('#type' => 'hidden', '#value' => 'delete'); - if (!$comment_counter) { - drupal_set_message($this->t('There do not appear to be any comments to delete, or your selected comment was deleted by another administrator.')); - $form_state['redirect_route']['route_name'] = 'comment.admin'; - } - return parent::buildForm($form, $form_state); } @@ -119,12 +126,13 @@ public function buildForm(array $form, array &$form_state) { * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { - if ($form_state['values']['confirm']) { + if ($form_state['values']['confirm'] && !empty($this->comments)) { $this->commentStorage->delete($this->comments); - Cache::invalidateTags(array('content' => TRUE)); - $count = count($form_state['values']['comments']); + $this->tempStoreFactory->get('comment_multiple_delete_confirm')->delete(\Drupal::currentUser()->id()); + $count = count($this->comments); watchdog('content', 'Deleted @count comments.', array('@count' => $count)); - drupal_set_message(format_plural($count, 'Deleted 1 comment.', 'Deleted @count comments.')); + drupal_set_message($this->translationManager()->formatPlural($count, 'Deleted 1 comment.', 'Deleted @count comments.')); + Cache::invalidateTags(array('content' => TRUE)); } $form_state['redirect_route']['route_name'] = 'comment.admin'; } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php index f6137ad..d5a9178 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php @@ -50,7 +50,7 @@ public function buildOptionsForm(&$form, &$form_state) { protected function renderLink($data, ResultRow $values) { parent::renderLink($data, $values); // Ensure user has access to edit this comment. - $comment = $this->getValue($values); + $comment = $data; if (!$comment->access('update')) { return; } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php index 4f2f211..2245fd2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php @@ -91,7 +91,7 @@ function testApprovalAdminInterface() { ); $this->drupalPostForm(NULL, $edit, t('Update')); $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.'); - $this->drupalPostForm(NULL, $edit, t('Delete comments')); + $this->drupalPostForm(NULL, $edit, t('Delete')); $this->assertText(t('No comments available.'), 'All comments were deleted.'); // Test message when no comments selected. $edit = array( diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php index dd0c0fe..bba9bcd 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php @@ -201,7 +201,7 @@ function performCommentOperation($comment, $operation, $approval = FALSE) { $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update')); if ($operation == 'delete') { - $this->drupalPostForm(NULL, array(), t('Delete comments')); + $this->drupalPostForm(NULL, array(), t('Delete')); $this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation))); } else { diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php index c1edf13..b4869ee 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php @@ -329,7 +329,7 @@ function performCommentOperation(CommentInterface $comment, $operation, $approva $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update')); if ($operation == 'delete') { - $this->drupalPostForm(NULL, array(), t('Delete comments')); + $this->drupalPostForm(NULL, array(), t('Delete')); $this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation))); } else { diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml index 4b95eb3..345dc20 100644 --- a/core/modules/node/config/install/views.view.content.yml +++ b/core/modules/node/config/install/views.view.content.yml @@ -1,110 +1,111 @@ -base_field: nid -base_table: node +base_field: cid +base_table: comment core: 8.x -description: 'Find and manage content.' +description: 'Find and manage comments.' status: true display: default: + display_plugin: default + id: default + display_title: Master + position: 1 display_options: access: type: perm options: - perm: 'access content overview' - provider: user + perm: 'administer comments' cache: type: none - provider: views + options: { } query: type: views_query - provider: views + options: + disable_sql_rewrite: false + distinct: false + slave: false + query_comment: false + query_tags: { } exposed_form: type: basic options: - submit_button: Filter - reset_button: true + 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 - provider: views pager: type: full options: items_per_page: 50 - provider: views + 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, 20, 40, 60' + 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 + row_class_special: true override: true - sticky: true + sticky: false caption: '' summary: '' description: '' columns: - node_bulk_form: node_bulk_form - title: title - type: type + subject: subject name: name - status: status - changed: changed - edit_node: edit_node - delete_node: delete_node - translation_link: translation_link + title: title + edit_comment: edit_comment dropbutton: dropbutton - timestamp: title + translation_link: translation_link + changed: changed info: - node_bulk_form: - align: '' - separator: '' - empty_column: false - responsive: '' - title: + subject: sortable: true default_sort_order: asc align: '' separator: '' empty_column: false responsive: '' - type: + name: sortable: true default_sort_order: asc align: '' separator: '' empty_column: false - responsive: '' - name: + responsive: priority-medium + title: sortable: false default_sort_order: asc align: '' separator: '' empty_column: false responsive: priority-low - status: - sortable: true - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - changed: - sortable: true - default_sort_order: desc - align: '' - separator: '' - empty_column: false - responsive: priority-low - edit_node: + edit_comment: sortable: false default_sort_order: asc align: '' separator: '' empty_column: false responsive: '' - delete_node: + dropbutton: sortable: false default_sort_order: asc align: '' @@ -112,200 +113,196 @@ display: empty_column: false responsive: '' translation_link: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - dropbutton: - sortable: false - default_sort_order: asc align: '' separator: '' empty_column: false responsive: '' - timestamp: - sortable: false - default_sort_order: asc + changed: + sortable: true + default_sort_order: desc align: '' separator: '' empty_column: false - responsive: '' - default: changed - empty_table: true - provider: views + responsive: priority-low + default: changed + empty_table: false row: type: fields - provider: views + relationships: + node: + id: node + table: comment + field: node + required: true + relationship: none + group_type: group + admin_label: Content fields: - node_bulk_form: - id: node_bulk_form - table: node - field: node_bulk_form + comment_bulk_form: + id: comment_bulk_form + table: comment + field: comment_bulk_form + relationship: none + group_type: group + admin_label: '' label: '' 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: '' + 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 - plugin_id: node_bulk_form - provider: node - title: - id: title - table: node_field_data - field: title - label: Title - exclude: false - alter: - alter_text: false - element_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - link_to_node: true - plugin_id: node - provider: node - type: - id: type - table: node_field_data - field: type - label: 'Content Type' + action_title: 'Update Options' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_unpublish_action: comment_unpublish_action + plugin_id: comment_bulk_form + provider: comment + subject: + id: subject + table: comment + 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: '' + 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 - link_to_node: false - machine_name: '' - plugin_id: node_type - provider: node + link_to_comment: true + link_to_entity: false + provider: comment name: id: name - table: users + table: comment field: name - relationship: uid + relationship: none + group_type: group + admin_label: '' label: Author 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' element_default_classes: true empty: '' hide_empty: false empty_zero: false hide_alter_empty: true link_to_user: true - overwrite_anonymous: false - anonymous_text: '' - format_username: true - plugin_id: user_name - provider: user - status: - id: status - table: node_field_data - field: status - label: Status - exclude: false - alter: - alter_text: false - element_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - type: published-notpublished - type_custom_true: '' - type_custom_false: '' - not: '' - plugin_id: boolean - provider: views - changed: - id: changed + plugin_id: comment_username + provider: comment + title: + id: title table: node_field_data - field: changed - label: Updated - exclude: false - alter: - alter_text: false - element_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - date_format: short - custom_date_format: '' - timezone: '' - plugin_id: date - provider: views - edit_node: - id: edit_node - table: node - field: edit_node - label: '' - exclude: true - text: Edit - plugin_id: node_link_edit - provider: node - delete_node: - id: delete_node - table: node - field: delete_node - label: '' - exclude: true - text: Delete - plugin_id: node_link_delete - provider: node - translation_link: - id: translation_link - table: node - field: translation_link - label: '' - exclude: true - alter: - alter_text: false - element_class: '' - element_default_classes: true - hide_alter_empty: true - hide_empty: false - empty_zero: false - empty: '' - text: Translate - optional: true - plugin_id: content_translation_link - provider: content_translation - dropbutton: - id: dropbutton - table: views - field: dropbutton - label: Operations - fields: - edit_node: edit_node - delete_node: delete_node - translation_link: translation_link - destination: true - plugin_id: dropbutton - provider: views - timestamp: - id: timestamp - table: history - field: timestamp - relationship: none + field: title + relationship: node group_type: group admin_label: '' - label: 'Has new content' + label: 'Posted in' exclude: false alter: alter_text: false @@ -346,219 +343,876 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - link_to_node: false - comments: false - optional: true - plugin_id: history_user_timestamp - provider: history - filters: - status_extra: - id: status_extra - table: node_field_data - field: status_extra - operator: '=' - value: false - plugin_id: node_status + link_to_node: true + plugin_id: node provider: node - group: 1 - status: - id: status - table: node_field_data - field: status + changed: + id: changed + table: comment + field: changed relationship: none group_type: group admin_label: '' - operator: '=' - value: true - group: 1 - exposed: true - expose: - operator_id: '' - label: Status - description: '' - use_operator: false - operator: status_op - identifier: status + label: Updated + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + provider: views + edit_comment: + id: edit_comment + table: comment + field: edit_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: edit + link_to_entity: 0 + destination: 0 + plugin_id: comment_link_edit + provider: comment + delete_comment: + id: delete_comment + table: comment + field: delete_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: delete + link_to_entity: 0 + plugin_id: comment_link_delete + provider: comment + translation_link: + id: translation_link + table: comment + field: translation_link + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: translate + plugin_id: content_translation_link + provider: content_translation + dropbutton: + id: dropbutton + table: views + field: dropbutton + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + fields: + edit_comment: edit_comment + delete_comment: delete_comment + translation_link: translation_link + action_bulk_form: 0 + subject: 0 + name: 0 + title: 0 + changed: 0 + destination: 1 + plugin_id: dropbutton + provider: views + filters: + status: + value: '1' + table: comment + field: status + provider: comment + id: status + expose: + operator: '' + group: '1' + sorts: + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + order: DESC + exposed: false + expose: + label: '' + granularity: second + plugin_id: date + provider: views + title: Comment + header: { } + footer: { } + empty: + area: + id: area + table: views + field: area + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: false + content: 'No comments available.' + format: basic_html + plugin_id: text + provider: views + arguments: { } + page_1: + display_plugin: page + id: page_1 + display_title: 'Published Comments' + position: 1 + display_options: + path: admin/content/comment + menu: + type: tab + title: Comments + description: 'Comments published' + name: admin + weight: 0 + context: '0' + display_description: '' + page_2: + display_plugin: page + id: page_2 + display_title: 'Unapproved Comments' + position: 2 + display_options: + path: admin/content/comment/approval + menu: + type: tab + title: 'Unapproved comments' + description: 'Comments unapproved' + name: admin + weight: 1 + context: '0' + display_description: '' + filters: + status: + id: status + table: comment + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '0' + group: '1' + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' required: false remember: false multiple: false remember_roles: authenticated: authenticated - is_grouped: true + is_grouped: false group_info: - label: 'Published status' + label: '' description: '' - identifier: status + identifier: '' optional: true widget: select multiple: false - remember: false + remember: 0 default_group: All default_group_multiple: { } - group_items: - 1: - title: Published - operator: '=' - value: '1' - 2: - title: Unpublished - operator: '=' - value: '0' - plugin_id: boolean + group_items: { } + provider: comment + defaults: + filters: false + filter_groups: false + fields: false + filter_groups: + operator: AND + groups: + 1: AND + fields: + comment_bulk_form: + id: comment_bulk_form + table: comment + field: comment_bulk_form + relationship: none + group_type: group + admin_label: '' + label: '' + 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: '' + 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 + action_title: 'Update Options' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_publish_action: comment_publish_action + plugin_id: comment_bulk_form + provider: comment + subject: + id: subject + table: comment + 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: '' + 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 + link_to_comment: 1 + link_to_entity: 0 + provider: comment + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_user: 1 + plugin_id: comment_username + provider: comment + title: + id: title + table: node_field_data + field: title + relationship: node + group_type: group + admin_label: '' + label: 'Posted in' + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_node: 1 + plugin_id: node + provider: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date provider: views - type: - id: type - table: node_field_data - field: type + edit_comment: + id: edit_comment + table: comment + field: edit_comment relationship: none group_type: group admin_label: '' - operator: in - value: { } - group: 1 - exposed: true - expose: - operator_id: type_op - label: Type - description: '' - use_operator: false - operator: type_op - identifier: type - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - administrator: '0' - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - plugin_id: bundle - provider: views - title: - id: title - table: node_field_data - field: title + label: '' + exclude: true + 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: '' + 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 + text: edit + link_to_entity: 0 + destination: 0 + plugin_id: comment_link_edit + provider: comment + delete_comment: + id: delete_comment + table: comment + field: delete_comment relationship: none group_type: group admin_label: '' - operator: contains - value: '' - group: 1 - exposed: true - expose: - operator_id: title_op - label: Title - description: '' - use_operator: false - operator: title_op - identifier: title - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - administrator: '0' - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - plugin_id: string - provider: views - langcode: - id: langcode - table: node_revision - field: langcode - operator: in - value: { } - group: 1 - exposed: true - expose: - operator_id: langcode_op - label: Language - operator: langcode_op - identifier: langcode - remember_roles: - authenticated: authenticated - optional: true - plugin_id: language - provider: language - sorts: { } - title: Content - empty: - area_text_custom: - id: area_text_custom + label: '' + exclude: true + 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: '' + 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 + text: delete + link_to_entity: 0 + plugin_id: comment_link_delete + provider: comment + translation_link: + id: translation_link + table: comment + field: translation_link + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + 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: '' + 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 + text: translate + plugin_id: content_translation_link + provider: content_translation + dropbutton: + id: dropbutton table: views - field: area_text_custom - empty: true - content: 'No content available.' - plugin_id: text_custom - provider: views - arguments: { } - relationships: - uid: - id: uid - table: node_field_data - field: uid - admin_label: author - required: true - plugin_id: standard + field: dropbutton + 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: '' + 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: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + fields: + edit_comment: edit_comment + delete_comment: delete_comment + translation_link: translation_link + action_bulk_form: 0 + subject: 0 + name: 0 + title: 0 + changed: 0 + destination: 1 + plugin_id: dropbutton provider: views - show_admin_links: false - filter_groups: - operator: AND - groups: - 1: AND - display_plugin: default - display_title: Master - id: default - position: 0 - page_1: - display_options: - path: admin/content/node - menu: - type: 'default tab' - title: Content - description: '' - name: admin - weight: -10 - context: '' - tab_options: - type: normal - title: Content - description: 'Find and manage content' - name: admin - weight: -10 - display_plugin: page - display_title: Page - id: page_1 - position: 1 -label: Content -module: node -id: content -tag: default +label: Comment +module: views +id: comment +tag: '' langcode: en -dependencies: - module: - - node - - user diff --git a/core/modules/node/tests/Drupal/node/Tests/Plugin/views/field/NodeBulkFormTest.php b/core/modules/node/tests/Drupal/node/Tests/Plugin/views/field/NodeBulkFormTest.php index 5deb7c5..4007d9b 100644 --- a/core/modules/node/tests/Drupal/node/Tests/Plugin/views/field/NodeBulkFormTest.php +++ b/core/modules/node/tests/Drupal/node/Tests/Plugin/views/field/NodeBulkFormTest.php @@ -89,7 +89,8 @@ public function testConstructor() { $definition['title'] = ''; $options = array(); - $node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', $definition, $entity_storage); + $form_builder = $this->getMock('Drupal\Core\Form\FormBuilderInterface'); + $node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', $definition, $entity_storage, $form_builder); $node_bulk_form->init($executable, $display, $options); $this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $node_bulk_form); diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php index fc9898d..5c9ddcc 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php +++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php @@ -14,6 +14,7 @@ use Drupal\views\ResultRow; use Drupal\views\ViewExecutable; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Form\FormBuilderInterface; /** * Defines a actions-based bulk operation form element. @@ -37,6 +38,13 @@ class BulkForm extends FieldPluginBase { protected $actions = array(); /** + * The form builder service. + * + * @var \Drupal\Core\Form\FormBuilderInterface + */ + protected $formBuilder; + + /** * Constructs a new BulkForm object. * * @param array $configuration @@ -47,18 +55,28 @@ class BulkForm extends FieldPluginBase { * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The action storage. + * @param \Drupal\Core\Form\FormValidatorInterface $form_builder + * The form builder. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, + FormBuilderInterface $form_builder) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->actionStorage = $storage; + $this->formBuilder = $form_builder; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')->getStorage('action')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity.manager')->getStorage('action'), + $container->get('form_builder') + ); } /** @@ -292,7 +310,7 @@ protected function emptySelectedMessage() { public function viewsFormValidate(&$form, &$form_state) { $selected = array_filter($form_state['values'][$this->options['id']]); if (empty($selected)) { - form_set_error('', $form_state, $this->emptySelectedMessage()); + $this->formBuilder->setErrorByName('', $form_state, $this->emptySelectedMessage()); } } diff --git a/core/modules/user/tests/Drupal/user/Tests/Plugin/views/field/UserBulkFormTest.php b/core/modules/user/tests/Drupal/user/Tests/Plugin/views/field/UserBulkFormTest.php index 642aacd..d17e928 100644 --- a/core/modules/user/tests/Drupal/user/Tests/Plugin/views/field/UserBulkFormTest.php +++ b/core/modules/user/tests/Drupal/user/Tests/Plugin/views/field/UserBulkFormTest.php @@ -89,7 +89,8 @@ public function testConstructor() { $definition['title'] = ''; $options = array(); - $user_bulk_form = new UserBulkForm(array(), 'user_bulk_form', $definition, $entity_storage); + $form_builder = $this->getMock('Drupal\Core\Form\FormBuilderInterface'); + $user_bulk_form = new UserBulkForm(array(), 'user_bulk_form', $definition, $entity_storage, $form_builder); $user_bulk_form->init($executable, $display, $options); $this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $user_bulk_form); diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 6e74149..683e4ce 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -144,10 +144,6 @@ public function testDefaultViews() { $tokens = array('@name' => $name, '@display_id' => $display_id); $this->assertTrue($view->executed, format_string('@name:@display_id has been executed.', $tokens)); - - $count = count($view->result); - $this->assertTrue($count > 0, format_string('@count results returned', array('@count' => $count))); - $view->destroy(); } } } -- 1.8.1.2 From 09818c6a2df8415391dc05ba1a243cb912e38c4b Mon Sep 17 00:00:00 2001 From: tkuldeep Date: Fri, 16 May 2014 17:05:41 +0530 Subject: [PATCH 2/2] Some changes done in AdminController file --- .../Drupal/comment/Controller/AdminController.php | 35 ++-------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php index 06fbee8..95b806f 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -11,7 +11,6 @@ use Drupal\field\FieldConfigInterface; use Drupal\Component\Utility\String; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Form\FormBuilderInterface; use Drupal\field_ui\FieldUI; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -29,19 +28,11 @@ class AdminController extends ControllerBase { protected $commentManager; /** - * The form builder. - * - * @var \Drupal\Core\Form\FormBuilderInterface - */ - protected $formBuilder; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( - $container->get('comment.manager'), - $container->get('form_builder') + $container->get('comment.manager') ); } @@ -53,9 +44,8 @@ public static function create(ContainerInterface $container) { * @param \Drupal\Core\Form\FormBuilderInterface $form_builder * The form builder. */ - public function __construct(CommentManagerInterface $comment_manager, FormBuilderInterface $form_builder) { + public function __construct(CommentManagerInterface $comment_manager) { $this->commentManager = $comment_manager; - $this->formBuilder = $form_builder; } /** @@ -178,25 +168,4 @@ public function overviewBundles() { return $build; } - /** - * Presents an administrative comment listing. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * The request of the page. - * @param string $type - * The type of the overview form ('approval' or 'new') default to 'new'. - * - * @return array - * Then comment multiple delete confirmation form or the comments overview - * administration form. - */ - public function adminPage(Request $request, $type = 'new') { - if ($request->request->get('operation') == 'delete' && $request->request->get('comments')) { - return $this->formBuilder->getForm('\Drupal\comment\Form\ConfirmDeleteMultiple', $request); - } - else { - return $this->formBuilder->getForm('\Drupal\comment\Form\CommentAdminOverview', $type); - } - } - } -- 1.8.1.2