diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index 66e2083..f243b1b 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -247,15 +247,23 @@ function comment_views_data() { ), ); - $data['comment']['view_comment'] = array( + // Define some fields based upon views_handler_field_entity in the entity + // table so they can be re-used with other query backends. + // @see views_handler_field_entity + + // Define the base group of this table. Fields that don't have a group defined + // will go into this field by default. + $data['views_entity_comment']['table']['group'] = t('Comments'); + + $data['views_entity_comment']['view_comment'] = array( 'field' => array( 'title' => t('Link to comment'), - 'help' => t('Provide a simple link to view the comment.'), + 'help' => t('Provide a simple link to the comment.'), 'id' => 'comment_link', ), ); - $data['comment']['edit_comment'] = array( + $data['views_entity_comment']['edit_comment'] = array( 'field' => array( 'title' => t('Link to edit comment'), 'help' => t('Provide a simple link to edit the comment.'), @@ -263,7 +271,7 @@ function comment_views_data() { ), ); - $data['comment']['delete_comment'] = array( + $data['views_entity_comment']['delete_comment'] = array( 'field' => array( 'title' => t('Link to delete comment'), 'help' => t('Provide a simple link to delete the comment.'), @@ -271,7 +279,7 @@ function comment_views_data() { ), ); - $data['comment']['approve_comment'] = array( + $data['views_entity_comment']['approve_comment'] = array( 'field' => array( 'title' => t('Link to approve comment'), 'help' => t('Provide a simple link to approve the comment.'), @@ -279,7 +287,7 @@ function comment_views_data() { ), ); - $data['comment']['replyto_comment'] = array( + $data['views_entity_comment']['replyto_comment'] = array( 'field' => array( 'title' => t('Link to reply-to comment'), 'help' => t('Provide a simple link to reply to the comment.'), diff --git a/core/modules/comment/config/action.action.comment_delete_action.yml b/core/modules/comment/config/action.action.comment_delete_action.yml new file mode 100644 index 0000000..eda1ce0 --- /dev/null +++ b/core/modules/comment/config/action.action.comment_delete_action.yml @@ -0,0 +1,6 @@ +id: comment_delete_action +label: 'Delete comment' +status: '1' +langcode: en +type: comment +plugin: comment_delete_action diff --git a/core/modules/comment/config/views.view.comments.yml b/core/modules/comment/config/views.view.comments.yml new file mode 100644 index 0000000..2b3dedd --- /dev/null +++ b/core/modules/comment/config/views.view.comments.yml @@ -0,0 +1,1449 @@ +base_field: cid +base_table: comment +core: 8.x +description: 'Find and manage comments.' +status: '1' +display: + page_1: + display_plugin: page + id: page_1 + display_title: Comments + position: '' + display_options: + path: admin/content/comment + menu: + type: tab + title: Comments + description: 'Comments published' + name: admin + weight: '0' + context: '0' + display_description: '' + filters: + status: + id: status + table: comment + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '1' + group: '1' + exposed: '0' + expose: + operator_id: '0' + label: '' + description: '' + use_operator: '0' + operator: '0' + identifier: '' + required: '0' + remember: '0' + multiple: '0' + remember_roles: + authenticated: authenticated + is_grouped: '0' + group_info: + label: '' + description: '' + identifier: '' + optional: '1' + widget: select + multiple: '0' + remember: '0' + default_group: All + default_group_multiple: { } + group_items: { } + defaults: + filters: '0' + filter_groups: '0' + fields: '0' + filter_groups: + operator: AND + groups: + 1: AND + fields: + action_bulk_form: + id: action_bulk_form + table: action + field: action_bulk_form + relationship: none + group_type: group + admin_label: '' + label: 'Bulk update' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_unpublish_action: comment_unpublish_action + plugin_id: action_bulk_form + subject: + id: subject + table: comment + field: subject + relationship: none + group_type: group + admin_label: '' + label: Subject + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '0' + ellipsis: '0' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_comment: '1' + link_to_node: '0' + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_user: '1' + plugin_id: comment_username + title: + id: title + table: node_field_data + field: title + relationship: nid + group_type: group + admin_label: '' + label: 'Posted in' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_node: '1' + plugin_id: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + edit_comment: + id: edit_comment + table: views_entity_comment + field: edit_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: '1' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + text: Edit + link_to_node: '0' + destination: '0' + plugin_id: comment_link_edit + delete_comment: + id: delete_comment + table: views_entity_comment + field: delete_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: '1' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + text: Delete + link_to_node: '0' + plugin_id: comment_link_delete + dropbutton: + id: dropbutton + table: views + field: dropbutton + relationship: none + group_type: group + admin_label: '' + label: Operations + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + fields: + edit_comment: edit_comment + delete_comment: delete_comment + action_bulk_form: '0' + subject: '0' + name: '0' + title: '0' + changed: '0' + destination: '1' + plugin_id: dropbutton + page_2: + display_plugin: page + id: page_2 + display_title: 'Unapproved comments' + position: '' + display_options: + display_description: 'Comments pending to approval' + path: admin/content/comment/approval + menu: + type: tab + title: 'Unapproved comments' + description: '' + name: admin + weight: '0' + context: '0' + filters: + status: + id: status + table: comment + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '0' + group: '1' + exposed: '0' + expose: + operator_id: '0' + label: '' + description: '' + use_operator: '0' + operator: '0' + identifier: '' + required: '0' + remember: '0' + multiple: '0' + remember_roles: + authenticated: authenticated + is_grouped: '0' + group_info: + label: '' + description: '' + identifier: '' + optional: '1' + widget: select + multiple: '0' + remember: '0' + default_group: All + default_group_multiple: { } + group_items: { } + defaults: + filters: '0' + filter_groups: '0' + fields: '0' + filter_groups: + operator: AND + groups: + 1: AND + fields: + action_bulk_form: + id: action_bulk_form + table: action + field: action_bulk_form + relationship: none + group_type: group + admin_label: '' + label: 'Bulk update' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + include_exclude: include + selected_actions: + comment_delete_action: comment_delete_action + comment_publish_action: comment_publish_action + plugin_id: action_bulk_form + subject: + id: subject + table: comment + field: subject + relationship: none + group_type: group + admin_label: '' + label: Subject + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '0' + ellipsis: '0' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_comment: '1' + link_to_node: '0' + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_user: '1' + plugin_id: comment_username + title: + id: title + table: node_field_data + field: title + relationship: nid + group_type: group + admin_label: '' + label: 'Posted in' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_node: '1' + plugin_id: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + approve_comment: + id: approve_comment + table: views_entity_comment + field: approve_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: '1' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + text: Approve + link_to_node: '0' + plugin_id: comment_link_approve + edit_comment: + id: edit_comment + table: views_entity_comment + field: edit_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: '1' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + text: Edit + link_to_node: '0' + destination: '0' + plugin_id: comment_link_edit + delete_comment: + id: delete_comment + table: views_entity_comment + field: delete_comment + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: '1' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + text: Delete + link_to_node: '0' + plugin_id: comment_link_delete + dropbutton: + id: dropbutton + table: views + field: dropbutton + relationship: none + group_type: group + admin_label: '' + label: Operations + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '0' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + fields: + approve_comment: approve_comment + edit_comment: edit_comment + delete_comment: delete_comment + action_bulk_form: '0' + subject: '0' + name: '0' + title: '0' + changed: '0' + destination: '1' + plugin_id: dropbutton + default: + display_plugin: default + id: default + display_title: Master + position: '' + display_options: + access: + type: perm + options: + perm: 'administer comments' + cache: + type: none + options: { } + query: + type: views_query + options: + disable_sql_rewrite: '0' + distinct: '0' + slave: '0' + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: '0' + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: '1' + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: full + options: + items_per_page: '50' + offset: '0' + id: '0' + total_pages: '' + expose: + items_per_page: '0' + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 20, 40, 60' + items_per_page_options_all: '0' + items_per_page_options_all_label: '- All -' + offset: '0' + offset_label: Offset + tags: + previous: '‹ previous' + next: 'next ›' + first: '« first' + last: 'last »' + quantity: '9' + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: '1' + row_class_special: '1' + override: '1' + sticky: '0' + summary: '' + columns: + action_bulk_form: action_bulk_form + subject: subject + name: name + title: title + changed: changed + info: + action_bulk_form: + sortable: '0' + default_sort_order: asc + align: '' + separator: '' + empty_column: '0' + responsive: '' + subject: + sortable: '1' + default_sort_order: asc + align: '' + separator: '' + empty_column: '0' + responsive: '' + name: + sortable: '1' + default_sort_order: asc + align: '' + separator: '' + empty_column: '0' + responsive: '' + title: + sortable: '1' + default_sort_order: asc + align: '' + separator: '' + empty_column: '0' + responsive: '' + changed: + sortable: '1' + default_sort_order: desc + align: '' + separator: '' + empty_column: '0' + responsive: '' + default: changed + empty_table: '1' + row: + type: fields + relationships: + nid: + id: nid + table: comment + field: nid + required: '1' + relationship: none + group_type: group + admin_label: Content + fields: + action_bulk_form: + id: action_bulk_form + table: action + field: action_bulk_form + relationship: none + group_type: group + admin_label: '' + label: 'Bulk update' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + include_exclude: include + selected_actions: + comment_unpublish_action: comment_unpublish_action + plugin_id: action_bulk_form + subject: + id: subject + table: comment + field: subject + relationship: none + group_type: group + admin_label: '' + label: Subject + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '0' + ellipsis: '0' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_comment: '1' + link_to_node: '0' + name: + id: name + table: comment + field: name + relationship: none + group_type: group + admin_label: '' + label: Author + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_user: '1' + plugin_id: comment_username + title: + id: title + table: node_field_data + field: title + relationship: nid + group_type: group + admin_label: '' + label: 'Posted in' + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + link_to_node: '1' + plugin_id: node + changed: + id: changed + table: comment + field: changed + relationship: none + group_type: group + admin_label: '' + label: Updated + exclude: '0' + alter: + alter_text: '0' + text: '' + make_link: '0' + path: '' + absolute: '0' + external: '0' + replace_spaces: '0' + path_case: none + trim_whitespace: '0' + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: '0' + max_length: '' + word_boundary: '1' + ellipsis: '1' + more_link: '0' + more_link_text: '' + more_link_path: '' + strip_tags: '0' + trim: '0' + preserve_tags: '' + html: '0' + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: '1' + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: '1' + empty: '' + hide_empty: '0' + empty_zero: '0' + hide_alter_empty: '1' + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: date + filters: + status: + id: status + table: comment + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '1' + group: '1' + exposed: '0' + expose: + operator_id: '0' + label: '' + description: '' + use_operator: '0' + operator: '0' + identifier: '' + required: '0' + remember: '0' + multiple: '0' + remember_roles: + authenticated: authenticated + is_grouped: '0' + group_info: + label: '' + description: '' + identifier: '' + optional: '1' + widget: select + multiple: '0' + remember: '0' + default_group: All + default_group_multiple: { } + group_items: { } + sorts: + created: + id: created + table: comment + field: created + order: DESC + relationship: none + group_type: group + admin_label: '' + exposed: '0' + expose: + label: '' + granularity: second + title: Comments + header: { } + footer: { } + empty: + area_text_custom: + id: area_text_custom + table: views + field: area_text_custom + empty: '1' + content: 'No comments available.' + plugin_id: text_custom + arguments: { } +label: Comments +module: views +id: comments +tag: default +uuid: df052bd2-a90f-4632-811b-277cf6ef38eb +langcode: en diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 4e6ca4c..0e0b5b2 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -232,4 +232,5 @@ public function getChildCids(array $comments) { ->execute() ->fetchCol(); } + } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Action/DeleteComment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Action/DeleteComment.php new file mode 100644 index 0000000..6bfcb54 --- /dev/null +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Action/DeleteComment.php @@ -0,0 +1,34 @@ +delete(); + Cache::invalidateTags(array('content' => TRUE)); + } + +} diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php index d1e19f5..d22dccb 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/Link.php @@ -44,13 +44,24 @@ public function query() {} function render($values) { $comment = $this->getEntity($values); - return $this->render_link($comment, $values); + return $this->renderLink($comment, $values); } - function render_link($data, $values) { + /** + * Renders the comment action link in the view. + * + * @param \Drupal\comment\CommentInterface $comment + * Comment entity. + * @param array $values + * Array of values of the view row. + * + * @return string + * Rendered text to display. + * + */ + public function renderLink($comment, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); - $comment = $data; - $nid = $comment->nid; + $nid = $comment->nid->value; $cid = $comment->id(); $this->options['alter']['make_link'] = TRUE; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php index 49bcb58..aa29571 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkApprove.php @@ -23,17 +23,17 @@ public function access() { return user_access('administer comments'); } - function render_link($data, $values) { - $status = $this->getValue($values, 'status'); - + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { // Don't show an approve link on published nodes. - if ($status == COMMENT_PUBLISHED) { + if ($comment->status->value == COMMENT_PUBLISHED) { return; } $text = !empty($this->options['text']) ? $this->options['text'] : t('approve'); - $cid = $this->getValue($values, 'cid'); - + $cid = $comment->id(); $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "comment/" . $cid . "/approve"; $this->options['alter']['query'] = drupal_get_destination() + array('token' => drupal_get_token("comment/$cid/approve")); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php index 23c96de..dad4c39 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkDelete.php @@ -19,16 +19,22 @@ class LinkDelete extends Link { public function access() { - //needs permission to administer comments in general + // Needs permission to administer comments in general. return user_access('administer comments'); } - function render_link($data, $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : t('delete'); - $cid = $this->getValue($values, 'cid'); + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { + // Ensure user has access to edit this comment. + if (!$comment->access('delete')) { + return; + } + $text = !empty($this->options['text']) ? $this->options['text'] : t('delete'); $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['path'] = "comment/" . $cid . "/delete"; + $this->options['alter']['path'] = "comment/" . $comment->id() . "/delete"; $this->options['alter']['query'] = drupal_get_destination(); return $text; 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 d77b824..28abc82 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 @@ -37,10 +37,17 @@ public function buildOptionsForm(&$form, &$form_state) { ); } - function render_link($data, $values) { - parent::render_link($data, $values); + public function access() { + // Needs permission to administer comments in general. + return user_access('administer comments'); + } + + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { + parent::renderLink($comment, $values); // Ensure user has access to edit this comment. - $comment = $this->getValue($values); if (!$comment->access('update')) { return; } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php index 112462f..bd58653 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkReply.php @@ -19,17 +19,18 @@ class LinkReply extends Link { public function access() { - //check for permission to reply to comments + // Check for the permission to reply to comments. return user_access('post comments'); } - function render_link($data, $values) { + /** + * {@inheritdoc} + */ + public function renderLink($comment, $values) { $text = !empty($this->options['text']) ? $this->options['text'] : t('reply'); - $nid = $this->getValue($values, 'nid'); - $cid = $this->getValue($values, 'cid'); $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['path'] = "comment/reply/" . $nid . '/' . $cid; + $this->options['alter']['path'] = "comment/reply/" . $comment->nid->value . '/' . $comment->id(); return $text; } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php index 94a1651..24c12b2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php @@ -19,6 +19,13 @@ class CommentActionsTest extends CommentTestBase { */ public static $modules = array('dblog', 'action'); + /** + * The entity manager. + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $manager; + public static function getInfo() { return array( 'name' => 'Comment actions', @@ -27,22 +34,30 @@ public static function getInfo() { ); } + function setUp() { + parent::setUp(); + + $this->manager = $this->container->get('plugin.manager.entity'); + } + /** * Tests comment publish and unpublish actions. */ - function testCommentPublishUnpublishActions() { + public function testCommentPublishUnpublishActions() { $this->drupalLogin($this->web_user); $comment_text = $this->randomName(); $subject = $this->randomName(); $comment = $this->postComment($this->node, $comment_text, $subject); // Unpublish a comment. - $action = entity_load('action', 'comment_unpublish_action'); + $actions = $this->manager->getStorageController('action')->load(array('comment_unpublish_action')); + $action = reset($actions); $action->execute(array($comment)); $this->assertEqual($comment->status->value, COMMENT_NOT_PUBLISHED, 'Comment was unpublished'); // Publish a comment. - $action = entity_load('action', 'comment_publish_action'); + $actions = $this->manager->getStorageController('action')->load(array('comment_publish_action')); + $action = reset($actions); $action->execute(array($comment)); $this->assertEqual($comment->status->value, COMMENT_PUBLISHED, 'Comment was published'); } @@ -50,11 +65,11 @@ function testCommentPublishUnpublishActions() { /** * Tests the unpublish comment by keyword action. */ - function testCommentUnpublishByKeyword() { + public function testCommentUnpublishByKeyword() { $this->drupalLogin($this->admin_user); $keyword_1 = $this->randomName(); $keyword_2 = $this->randomName(); - $action = entity_create('action', array( + $action = $this->manager->getStorageController('action')->create(array( 'id' => 'comment_unpublish_by_keyword_action', 'label' => $this->randomName(), 'type' => 'comment', @@ -68,7 +83,7 @@ function testCommentUnpublishByKeyword() { $comment = $this->postComment($this->node, $keyword_2, $this->randomName()); // Load the full comment so that status is available. - $comment = comment_load($comment->id()); + $this->manager->getStorageController('comment')->load(array($comment->id())); $this->assertTrue($comment->status->value == COMMENT_PUBLISHED, 'The comment status was set to published.'); @@ -76,4 +91,23 @@ function testCommentUnpublishByKeyword() { $this->assertTrue($comment->status->value == COMMENT_NOT_PUBLISHED, 'The comment status was set to not published.'); } + /** + * Tests comment delete action. + */ + public function testCommentDeleteAction() { + $this->drupalLogin($this->admin_user); + $comment_text = $this->randomName(); + $subject = $this->randomName(); + $comment = $this->postComment($this->node, $comment_text, $subject); + + // Delete a comment. + $actions = $this->manager->getStorageController('action')->load(array('comment_delete_action')); + $action = reset($actions); + $action->execute(array($comment)); + + // Try to load the comment again. + $comment = $this->manager->getStorageController('comment')->load(array($comment->id())); + $this->assertTrue(empty($comment), 'Comment was deleted'); + } + } diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index cdbff1a..d797f3e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\views\ViewExecutable; +use Drupal\Component\Utility\Unicode; /** * Tests for views default views. @@ -24,6 +25,13 @@ class DefaultViewsTest extends ViewTestBase { public static $modules = array('views', 'node', 'search', 'comment', 'taxonomy', 'block'); /** + * The vocabulary used for creating terms. + * + * @var \Drupal\taxonomy\VocabularyInterface + */ + protected $vocabulary; + + /** * An array of argument arrays to use for default views. * * @var array @@ -51,7 +59,7 @@ protected function setUp() { $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'description' => $this->randomName(), - 'vid' => drupal_strtolower($this->randomName()), + 'vid' => Unicode::strtolower($this->randomName()), 'langcode' => Language::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('page' => 'page'), @@ -60,9 +68,9 @@ protected function setUp() { $this->vocabulary->save(); // Setup a field and instance. - $this->field_name = drupal_strtolower($this->randomName()); + $field_name = Unicode::strtolower($this->randomName()); entity_create('field_entity', array( - 'field_name' => $this->field_name, + 'field_name' => $field_name, 'type' => 'taxonomy_term_reference', 'settings' => array( 'allowed_values' => array( @@ -74,7 +82,7 @@ protected function setUp() { ) ))->save(); entity_create('field_instance', array( - 'field_name' => $this->field_name, + 'field_name' => $field_name, 'entity_type' => 'node', 'bundle' => 'page', ))->save(); @@ -84,10 +92,10 @@ protected function setUp() { for ($i = 0; $i <= 10; $i++) { $user = $this->drupalCreateUser(); - $term = $this->createTerm($this->vocabulary); + $term = $this->createTerm(); $values = array('created' => $time, 'type' => 'page'); - $values[$this->field_name][]['target_id'] = $term->id(); + $values[$field_name][]['target_id'] = $term->id(); // Make every other node promoted. if ($i % 2) { @@ -105,10 +113,40 @@ protected function setUp() { 'node_type' => 'node_type_' . $node->bundle(), ); entity_create('comment', $comment)->save(); + + $comment = array( + 'uid' => $user->uid, + 'nid' => $node->nid, + 'node_type' => 'node_type_' . $node->bundle(), + 'status' => 0, + ); + entity_create('comment', $comment)->save(); + } } /** + * Returns a new term with random properties in vocabulary $vid. + * + * @return \Drupal\taxonomy\TermInterface + * Taxonomy term created. + */ + function createTerm() { + $filter_formats = filter_formats(); + $format = array_pop($filter_formats); + $term = entity_create('taxonomy_term', array( + 'name' => $this->randomName(), + 'description' => $this->randomName(), + // Use the first available text format. + 'format' => $format->format, + 'vid' => $this->vocabulary->id(), + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + )); + $term->save(); + return $term; + } + + /** * Test that all Default views work as expected. */ public function testDefaultViews() { @@ -141,24 +179,6 @@ public function testDefaultViews() { } /** - * Returns a new term with random properties in vocabulary $vid. - */ - function createTerm($vocabulary) { - $filter_formats = filter_formats(); - $format = array_pop($filter_formats); - $term = entity_create('taxonomy_term', array( - 'name' => $this->randomName(), - 'description' => $this->randomName(), - // Use the first available text format. - 'format' => $format->format, - 'vid' => $vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, - )); - $term->save(); - return $term; - } - - /** * Tests the archive view. */ public function testArchiveView() {