diff --git a/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php index 50829f0..8e1f3ab 100644 --- a/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/src/Tests/d6/MigrateUpgrade6Test.php @@ -63,7 +63,7 @@ protected function getEntityCounts() { 'user' => 7, 'user_role' => 6, 'menu_link_content' => 4, - 'view' => 12, + 'view' => 13, 'date_format' => 11, 'entity_form_display' => 15, 'entity_form_mode' => 1, diff --git a/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php b/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php index 1a0e334..275d53c 100644 --- a/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php +++ b/core/modules/migrate_drupal_ui/src/Tests/d7/MigrateUpgrade7Test.php @@ -64,7 +64,7 @@ protected function getEntityCounts() { 'user' => 4, 'user_role' => 3, 'menu_link_content' => 7, - 'view' => 12, + 'view' => 13, 'date_format' => 11, 'entity_form_display' => 16, 'entity_form_mode' => 1, diff --git a/core/modules/node/config/optional/views.view.content_revisions.yml b/core/modules/node/config/optional/views.view.content_revisions.yml new file mode 100644 index 0000000..4066c62 --- /dev/null +++ b/core/modules/node/config/optional/views.view.content_revisions.yml @@ -0,0 +1,713 @@ +langcode: en +status: true +dependencies: + module: + - node + - user +id: content_revisions +label: 'Content Revisions' +module: views +description: 'View the revisions of a node.' +tag: '' +base_table: node_field_revision +base_field: vid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + options: + perm: 'view all revisions' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: full + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: '‹ Previous' + next: 'Next ›' + first: '« First' + last: 'Last »' + quantity: 9 + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + override: true + sticky: false + caption: '' + summary: '' + description: '' + columns: + title: title + revision_timestamp: revision_timestamp + uid: revision_timestamp + moderation_state: moderation_state + set_current_revision: set_current_revision + link_to_revision: link_to_revision + delete_revision: delete_revision + dropbutton: dropbutton + info: + title: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + revision_timestamp: + sortable: false + default_sort_order: asc + align: '' + separator: ' by ' + empty_column: false + responsive: '' + uid: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + moderation_state: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + set_current_revision: + align: '' + separator: '' + empty_column: false + responsive: '' + link_to_revision: + align: '' + separator: '' + empty_column: false + responsive: '' + delete_revision: + align: '' + separator: '' + empty_column: false + responsive: '' + dropbutton: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + default: '-1' + empty_table: false + row: + type: fields + fields: + title: + id: title + table: node_field_revision + field: title + relationship: none + group_type: group + admin_label: '' + label: Title + 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: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: node + entity_field: title + plugin_id: field + revision_timestamp: + id: revision_timestamp + table: node_revision + field: revision_timestamp + relationship: none + group_type: group + admin_label: '' + label: Revision + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: timestamp + settings: + date_format: short + custom_date_format: '' + timezone: '' + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: node + entity_field: revision_timestamp + plugin_id: field + uid: + id: uid + table: node_field_revision + field: uid + relationship: none + group_type: group + admin_label: '' + label: 'Authored by' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: node + entity_field: uid + plugin_id: field + revision_log: + id: revision_log + table: node_revision + field: revision_log + relationship: none + group_type: group + admin_label: '' + label: 'Log message' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: basic_string + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: node + entity_field: revision_log + plugin_id: field + link_to_revision: + id: link_to_revision + table: node_field_revision + field: link_to_revision + 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: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: true + 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: false + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + text: '' + entity_type: node + plugin_id: node_revision_link + revert_revision: + id: revert_revision + table: node_field_revision + field: revert_revision + relationship: none + group_type: group + admin_label: '' + label: 'Link to revert revision' + 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: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + text: Revert + entity_type: node + plugin_id: node_revision_link_revert + delete_revision: + id: delete_revision + table: node_field_revision + field: delete_revision + relationship: none + group_type: group + admin_label: '' + label: 'Link to delete revision' + 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: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + text: Delete + entity_type: node + plugin_id: node_revision_link_delete + 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: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + fields: + link_to_revision: link_to_revision + revert_revision: revert_revision + delete_revision: delete_revision + title: '0' + revision_timestamp: '0' + uid: '0' + destination: true + plugin_id: dropbutton + filters: { } + sorts: + revision_timestamp: + id: revision_timestamp + table: node_revision + field: revision_timestamp + relationship: none + group_type: group + admin_label: '' + order: DESC + exposed: false + expose: + label: '' + granularity: second + entity_type: node + entity_field: revision_timestamp + plugin_id: date + title: 'Revisions for {{ title }}' + header: { } + footer: { } + empty: { } + relationships: { } + arguments: + nid: + id: nid + table: node_field_revision + field: nid + relationship: none + group_type: group + admin_label: '' + default_action: empty + exception: + value: all + title_enable: false + title: All + title_enable: true + title: 'Revisions for {{ arguments.nid }}' + default_argument_type: fixed + default_argument_options: + argument: '' + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: node + entity_field: nid + plugin_id: node_nid + display_extenders: { } + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + display_extenders: { } + path: node/%/revisions + menu: + type: tab + title: Revisions + description: '' + expanded: false + parent: '' + weight: 0 + context: '0' + menu_name: main + enabled: true + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } diff --git a/core/modules/node/node.post_update.php b/core/modules/node/node.post_update.php new file mode 100644 index 0000000..dc30f8e --- /dev/null +++ b/core/modules/node/node.post_update.php @@ -0,0 +1,35 @@ +moduleExists('views')) { + if (!View::load('content_revisions')) { + // Save the content_revisions view to config. + $module_handler = \Drupal::moduleHandler(); + $optional_install_path = $module_handler->getModule('node')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; + $storage = new FileStorage($optional_install_path); + + \Drupal::entityTypeManager() + ->getStorage('view') + ->create($storage->read('views.view.content_revisions')) + ->save(); + + return t('The content_revisions view has been created.'); + } + + return t("The content_revisions view already exists and was not replaced."); + } +} diff --git a/core/modules/node/src/Tests/Update/NodeRevisionsViewsUpdateTest.php b/core/modules/node/src/Tests/Update/NodeRevisionsViewsUpdateTest.php new file mode 100644 index 0000000..bca6d7d --- /dev/null +++ b/core/modules/node/src/Tests/Update/NodeRevisionsViewsUpdateTest.php @@ -0,0 +1,53 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + ]; + } + + /** + * Tests that comment revisions view is enabled after update. + */ + public function testUpdateHookN() { + // Make sure the watchog view doesn't exist before the updates. + $view = \Drupal::entityTypeManager()->getStorage('view')->load('content_revisions'); + $this->assertNull($view); + + $this->runUpdates(); + // Ensure we can load the view from the storage after the update and it's + // enabled. + $entity_type_manager = \Drupal::entityTypeManager(); + /** @var \Drupal\views\ViewEntityInterface $view */ + $view = $entity_type_manager->getStorage('view')->load('content_revisions'); + $this->assertNotNull($view, 'Content revisions view exist in storage.'); + $this->assertTrue($view->enable(), 'Content revisions view is enabled.'); + } + +} diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php index 5c1f601..b2d9bc5 100644 --- a/core/modules/views/src/Tests/DefaultViewsTest.php +++ b/core/modules/views/src/Tests/DefaultViewsTest.php @@ -40,6 +40,7 @@ class DefaultViewsTest extends ViewTestBase { 'backlinks' => array(1), 'taxonomy_term' => array(1), 'glossary' => array('all'), + 'content_revisions' => array(1), ); protected function setUp() {