From ab66195b39aa3b7441614e3af71ad5aed987ab73 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Fri, 15 Nov 2024 14:50:46 +0100 Subject: [PATCH] Issue CollaboraOnline/collabora-drupal#52: Override groupmedia view. --- .../collabora_online_group.install | 22 + .../override/views.view.group_media.yml | 1014 +++++++++++++++++ .../{SmokeTest.php => InstallationTest.php} | 7 +- 3 files changed, 1039 insertions(+), 4 deletions(-) create mode 100644 modules/collabora_online_group/collabora_online_group.install create mode 100644 modules/collabora_online_group/config/override/views.view.group_media.yml rename modules/collabora_online_group/tests/src/Functional/{SmokeTest.php => InstallationTest.php} (77%) diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install new file mode 100644 index 00000000..8ff48a95 --- /dev/null +++ b/modules/collabora_online_group/collabora_online_group.install @@ -0,0 +1,22 @@ +moduleExists('views') && + \Drupal::entityTypeManager()->getStorage('view')->load('group_media') + ) { + // Update view with module configuration. + $name = 'views.view.group_media'; + $module_path = Drupal::moduleHandler()->getModule('collabora_online_group')->getPath(); + $source = new FileStorage($module_path . '/config/override'); + /** @var \Drupal\Core\Config\StorageInterface $active_storage */ + $active_storage = \Drupal::service('config.storage'); + $config = $source->read( $name); + $active_storage->write($name, $config); + } +} diff --git a/modules/collabora_online_group/config/override/views.view.group_media.yml b/modules/collabora_online_group/config/override/views.view.group_media.yml new file mode 100644 index 00000000..4082e523 --- /dev/null +++ b/modules/collabora_online_group/config/override/views.view.group_media.yml @@ -0,0 +1,1014 @@ +status: true +dependencies: + module: + - collabora_online + - group + - media + enforced: + module: + - groupmedia +id: group_media +label: 'Group Media' +module: views +description: '' +tag: '' +base_table: media_field_data +base_field: mid +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + title: 'Group Media' + fields: + name: + id: name + table: media_field_data + field: name + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: media + plugin_id: field + label: 'Media name' + exclude: false + alter: + alter_text: false + make_link: false + absolute: false + word_boundary: false + ellipsis: false + strip_tags: false + trim: false + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: true + group_column: value + group_columns: {} + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + bundle: + id: bundle + table: media_field_data + field: bundle + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: bundle + plugin_id: field + label: Bundle + 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: false + 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 + status: + id: status + table: media_field_data + field: status + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: status + plugin_id: field + label: Status + 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: boolean + settings: + format: yes-no + format_custom_false: '' + format_custom_true: '' + group_column: value + group_columns: {} + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + uid: + id: uid + table: media_field_data + field: uid + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: uid + plugin_id: field + label: Publisher + 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: false + 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 + collabora_preview: + id: collabora_preview + table: media + field: collabora_preview + relationship: none + group_type: group + admin_label: '' + entity_type: media + plugin_id: media_collabora_preview + 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: 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: 'Preview in Collabora' + collabora_edit: + id: collabora_edit + table: media + field: collabora_edit + relationship: none + group_type: group + admin_label: '' + entity_type: media + plugin_id: media_collabora_edit + 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: 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 in Collabora' + view_group_content: + id: view_group_content + table: group_relationship + field: view_group_content + relationship: group_content + group_type: group + admin_label: '' + entity_type: group_content + plugin_id: entity_link + label: 'View relation link' + 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: 'View relation' + output_url_as_text: false + absolute: false + edit_group_content: + id: edit_group_content + table: group_relationship + field: edit_group_content + relationship: group_content + group_type: group + admin_label: '' + entity_type: group_content + plugin_id: entity_link_edit + label: 'Edit relation link' + 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: 'Edit relation' + delete_group_content: + id: delete_group_content + table: group_relationship + field: delete_group_content + relationship: group_content + group_type: group + admin_label: '' + entity_type: group_content + plugin_id: entity_link_delete + label: 'Delete relation link' + 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 relation' + edit_media: + id: edit_media + table: media + field: edit_media + relationship: none + group_type: group + admin_label: '' + entity_type: media + plugin_id: entity_link_edit + label: 'Edit media' + 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: Edit + delete_media: + id: delete_media + table: media + field: delete_media + relationship: none + group_type: group + admin_label: '' + entity_type: media + plugin_id: entity_link_delete + label: 'Delete Media' + 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 + dropbutton: + id: dropbutton + table: views + field: dropbutton + relationship: none + group_type: group + admin_label: '' + plugin_id: dropbutton + label: Dropbutton + 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 + destination: true + fields: + collabora_preview: collabora_preview + collabora_edit: collabora_edit + view_group_content: view_group_content + edit_group_content: edit_group_content + delete_group_content: delete_group_content + edit_media: edit_media + delete_media: delete_media + name: '0' + bundle: '0' + status: '0' + pager: + type: mini + options: + offset: 0 + items_per_page: 50 + total_pages: null + id: 0 + tags: + next: ›› + previous: ‹‹ + 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 + 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 + access: + type: group_permission + options: + group_permission: 'access group_media overview' + cache: + type: tag + options: {} + empty: {} + sorts: {} + arguments: + gid: + id: gid + table: group_relationship_field_data + field: gid + relationship: group_content + group_type: group + admin_label: '' + entity_type: group_content + entity_field: gid + plugin_id: group_id + default_action: ignore + exception: + value: all + title_enable: false + title: All + title_enable: true + title: '{{ arguments.gid|placeholder }} media items' + default_argument_type: fixed + default_argument_options: + argument: '' + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + override: false + items_per_page: 25 + 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 + filters: + status: + id: status + table: media_field_data + field: status + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: status + plugin_id: boolean + operator: '=' + value: '1' + group: 1 + exposed: true + expose: + operator_id: '' + label: Status + description: null + use_operator: false + operator: status_op + identifier: status + required: true + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: true + group_info: + label: Status + description: '' + identifier: status + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: {} + group_items: + 1: + title: Published + operator: '=' + value: '1' + 2: + title: Unpublished + operator: '=' + value: '0' + bundle: + id: bundle + table: media_field_data + field: bundle + relationship: none + group_type: group + admin_label: '' + entity_type: media + entity_field: bundle + plugin_id: bundle + operator: in + value: {} + group: 1 + exposed: true + expose: + operator_id: bundle_op + label: 'Media type' + description: '' + use_operator: false + operator: bundle_op + identifier: bundle + 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: {} + style: + type: table + options: + grouping: {} + row_class: '' + default_row_class: true + columns: + name: name + bundle: bundle + status: status + uid: uid + view_group_content: view_group_content + edit_group_content: edit_group_content + delete_group_content: delete_group_content + edit_media: edit_media + delete_media: delete_media + dropbutton: dropbutton + default: '-1' + info: + name: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + bundle: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + status: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + uid: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + view_group_content: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + edit_group_content: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + delete_group_content: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + edit_media: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + delete_media: + 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: '' + override: true + sticky: false + summary: '' + empty_table: false + caption: '' + description: '' + row: + type: fields + query: + type: views_query + options: + query_comment: '' + disable_sql_rewrite: false + distinct: false + replica: false + query_tags: {} + relationships: + group_content: + id: group_content + table: media_field_data + field: group_content + relationship: none + group_type: group + admin_label: 'Media group content' + entity_type: media + plugin_id: group_content_to_entity_reverse + required: false + group_content_plugins: + 'group_media:audio': '0' + 'group_media:file': '0' + 'group_media:image': '0' + 'group_media:remote_video': '0' + 'group_media:video': '0' + header: {} + footer: {} + display_extenders: {} + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - route.group + - url + - url.query_args + - user.group_permissions + tags: {} + page_1: + id: page_1 + display_title: Page + display_plugin: page + position: 1 + display_options: + display_extenders: {} + path: group/%group/media + menu: + type: tab + title: Media + description: '' + weight: 0 + expanded: false + menu_name: main + parent: '' + context: '0' + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - route.group + - url + - url.query_args + - user.group_permissions + tags: {} diff --git a/modules/collabora_online_group/tests/src/Functional/SmokeTest.php b/modules/collabora_online_group/tests/src/Functional/InstallationTest.php similarity index 77% rename from modules/collabora_online_group/tests/src/Functional/SmokeTest.php rename to modules/collabora_online_group/tests/src/Functional/InstallationTest.php index 95a22e47..b5dce8f2 100644 --- a/modules/collabora_online_group/tests/src/Functional/SmokeTest.php +++ b/modules/collabora_online_group/tests/src/Functional/InstallationTest.php @@ -7,15 +7,16 @@ use Drupal\Tests\BrowserTestBase; /** - * Smoke test to check that CI is working. + * Test module installation with groupmedia view override. */ -class SmokeTest extends BrowserTestBase { +class InstallationTest extends BrowserTestBase { /** * {@inheritdoc} */ protected static $modules = [ 'collabora_online_group', + 'views', ]; /** @@ -25,8 +26,6 @@ class SmokeTest extends BrowserTestBase { /** * Tests that the module install correctly. - * - * To be removed when other tests are implemented. */ public function testModuleInstallation(): void { $this->drupalGet('');