From 98c3d04ec041469a2dc907ad440bd8b2e341355b Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 12 Nov 2024 10:10:42 +0100 Subject: [PATCH 01/21] Issue CollaboraOnline/collabora-drupal#52: Add links to operations. --- collabora_online.views.inc | 24 ++++++++++++++++ src/Plugin/views/field/CollaboraEdit.php | 32 +++++++++++++++++++++ src/Plugin/views/field/CollaboraPreview.php | 32 +++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 collabora_online.views.inc create mode 100644 src/Plugin/views/field/CollaboraEdit.php create mode 100644 src/Plugin/views/field/CollaboraPreview.php diff --git a/collabora_online.views.inc b/collabora_online.views.inc new file mode 100644 index 00000000..b19e22b3 --- /dev/null +++ b/collabora_online.views.inc @@ -0,0 +1,24 @@ + t('Preview operation in collabora'), + 'group' => t('Media'), + 'field' => [ + 'title' => t('Media preview in collabora'), + 'id' => 'media_collabora_preview', + ], + ]; + $data['media']['collabora_edit'] = [ + 'title' => t('Edit operation in collabora'), + 'group' => t('Media'), + 'field' => [ + 'title' => t('Media edit in collabora'), + 'id' => 'media_collabora_edit', + ], + ]; +} diff --git a/src/Plugin/views/field/CollaboraEdit.php b/src/Plugin/views/field/CollaboraEdit.php new file mode 100644 index 00000000..26add133 --- /dev/null +++ b/src/Plugin/views/field/CollaboraEdit.php @@ -0,0 +1,32 @@ +getEntity($row); + + if ($entity === NULL) { + return NULL; + } + + return CoolUtils::getEditorUrl($entity, TRUE); + } + +} diff --git a/src/Plugin/views/field/CollaboraPreview.php b/src/Plugin/views/field/CollaboraPreview.php new file mode 100644 index 00000000..1b0e4cb3 --- /dev/null +++ b/src/Plugin/views/field/CollaboraPreview.php @@ -0,0 +1,32 @@ +getEntity($row); + + if ($entity === NULL) { + return NULL; + } + + return CoolUtils::getEditorUrl($entity, FALSE); + } + +} From ce7d26055eaf68c7350d8b386687d50b15e1559c Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 12 Nov 2024 17:10:49 +0100 Subject: [PATCH 02/21] Issue CollaboraOnline/collabora-drupal#52: Add view field links test. --- collabora_online.views.inc | 5 +- config/schema/collabora_online.schema.yml | 12 + .../views.view.test_collabora_links.yml | 272 ++++++++++++++++++ tests/src/Kernel/ViewsLinkFieldsTest.php | 149 ++++++++++ 4 files changed, 436 insertions(+), 2 deletions(-) create mode 100644 tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml create mode 100644 tests/src/Kernel/ViewsLinkFieldsTest.php diff --git a/collabora_online.views.inc b/collabora_online.views.inc index b19e22b3..956ca91c 100644 --- a/collabora_online.views.inc +++ b/collabora_online.views.inc @@ -1,10 +1,11 @@ t('Preview operation in collabora'), 'group' => t('Media'), diff --git a/config/schema/collabora_online.schema.yml b/config/schema/collabora_online.schema.yml index 963dd305..6d16d9de 100644 --- a/config/schema/collabora_online.schema.yml +++ b/config/schema/collabora_online.schema.yml @@ -24,3 +24,15 @@ collabora_online.settings: allowfullscreen: type: boolean label: 'Allow full-screen.' + +views.field.media_collabora_preview: + type: views_field + label: 'Collabora preview link' + mapping: + text: + type: label + label: 'Text to display' + +views.field.media_collabora_edit: + type: views.field.media_collabora_preview + label: 'Collabora edit link' diff --git a/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml new file mode 100644 index 00000000..e5c96ff1 --- /dev/null +++ b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml @@ -0,0 +1,272 @@ +langcode: en +status: true +dependencies: + module: + - collabora_online + - media + - user +id: test_collabora_links +label: "Test collabora links" +module: views +description: "" +tag: "" +base_table: media_field_data +base_field: mid +display: + default: + id: default + display_title: Default + display_plugin: default + position: 0 + display_options: + 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: "" + 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 + 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: 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 + 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: 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 + text: "Edit in Collabora" + pager: + type: mini + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + 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: perm + options: + perm: "view media" + cache: + type: tag + options: {} + empty: {} + sorts: {} + arguments: {} + filters: + status: + id: status + table: media_field_data + field: status + entity_type: media + entity_field: status + plugin_id: boolean + value: "1" + group: 1 + expose: + operator: "" + style: + type: default + options: + grouping: {} + row_class: "" + default_row_class: true + uses_fields: false + row: + type: fields + options: + default_field_elements: true + inline: {} + separator: "" + hide_empty: false + query: + type: views_query + options: + query_comment: "" + disable_sql_rewrite: false + distinct: false + replica: false + query_tags: {} + relationships: {} + header: {} + footer: {} + display_extenders: {} + cache_metadata: + max-age: -1 + contexts: + - "languages:language_content" + - "languages:language_interface" + - url.query_args + - user.permissions + tags: {} + page_1: + id: page_1 + display_title: Page + display_plugin: page + position: 1 + display_options: + display_extenders: {} + path: test_collabora_links + cache_metadata: + max-age: -1 + contexts: + - "languages:language_content" + - "languages:language_interface" + - url.query_args + - user.permissions + tags: {} diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php new file mode 100644 index 00000000..5ccdbf08 --- /dev/null +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -0,0 +1,149 @@ +installEntitySchema('file'); + $this->installEntitySchema('media'); + $this->installEntitySchema('user'); + $this->installConfig(['user', 'views', 'collabora_online_test']); + $this->installSchema('file', ['file_usage']); + // Install user module avoid user 1 permissions bypass. + \Drupal::moduleHandler()->loadInclude('user', 'install'); + user_install(); + + // Create two medias to check access with different scopes, 'any' and 'own'. + $this->createMediaEntity('document'); + $this->ownMedia = $this->createMediaEntity('document');; + } + + /** + * Tests link fields. + */ + public function testLinks(): void { + // User without permissions can't see links. + $this->doTestLinks([ + 'preview' => [FALSE, FALSE], + 'edit' => [FALSE, FALSE], + ], + $this->createUser([])); + // User with 'Preview' permission can see preview link. + $this->doTestLinks([ + 'preview' => [TRUE, TRUE], + 'edit' => [FALSE, FALSE], + ], + $this->createUser([ + 'preview document in collabora' + ])); + // User with 'Edit any' permission can see edit link. + $this->doTestLinks([ + 'preview' => [FALSE, FALSE], + 'edit' => [TRUE, TRUE], + ], + $this->createUser([ + 'edit any document in collabora' + ])); + // User with 'Edit own' permission can see edit link for entities they own. + $this->doTestLinks([ + 'preview' => [FALSE, FALSE], + 'edit' => [FALSE, TRUE], + ], + $this->createUser([ + 'edit own document in collabora' + ])); + } + + /** + * Tests that links behave as expected. + * + * @param [] $expected_results + * An associative array of expected results keyed by operation. + * @param \Drupal\Core\Session\AccountInterface $account + * The user account to be used to run the test; + */ + protected function doTestLinks(array $expected_results, AccountInterface $account) { + $this->setCurrentUser(account: $account); + // Set the current user as the owner to check 'edit own' access. + $this->ownMedia->setOwnerId($account->id())->save(); + $view = Views::getView('test_collabora_links'); + $view->preview(); + + $info = [ + 'preview' => [ + 'label' => 'Preview in Collabora', + 'field_id' => 'collabora_preview', + 'route' => 'collabora-online.view' + ], + 'edit' => [ + 'label' => 'Edit in Collabora', + 'field_id' => 'collabora_edit', + 'route' => 'collabora-online.edit' + ], + ]; + + $i = 0; + // Check each expected results for every media. + foreach(Media::loadMultiple() as $media) { + foreach ($expected_results as $operation => $expected_result) { + $expected_link = ''; + // The operation array contains results for each of the entities. + if ($expected_result[$i]) { + $path = Url::fromRoute($info[$operation]['route'], ['media' => $media->id()])->toString(); + $expected_link = '' . $info[$operation]['label'] . ''; + } + // We check the output, whether it is a link or is empty (access denied). + $link = $view->style_plugin->getField($i, $info[$operation]['field_id']); + $this->assertEquals($expected_link, (string) $link); + } + $i++; + } + } + +} From 9d24e71717611e0fc7709ef69d53bcd6db3902ab Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Fri, 15 Nov 2024 14:50:46 +0100 Subject: [PATCH 03/21] 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(''); From deae83ff2328478ed799dbdbe74efe32148eda8a Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Mon, 18 Nov 2024 11:40:53 +0100 Subject: [PATCH 04/21] Issue CollaboraOnline/collabora-drupal#52: Add test to check changes on view. --- .../override/views.view.group_media.yml | 284 +----------------- .../tests/src/Functional/InstallationTest.php | 35 --- .../tests/src/Functional/ViewTest.php | 142 +++++++++ 3 files changed, 156 insertions(+), 305 deletions(-) delete mode 100644 modules/collabora_online_group/tests/src/Functional/InstallationTest.php create mode 100644 modules/collabora_online_group/tests/src/Functional/ViewTest.php 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 index 4082e523..0db5c082 100644 --- a/modules/collabora_online_group/config/override/views.view.group_media.yml +++ b/modules/collabora_online_group/config/override/views.view.group_media.yml @@ -369,263 +369,6 @@ display: 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 @@ -634,7 +377,7 @@ display: group_type: group admin_label: '' plugin_id: dropbutton - label: Dropbutton + label: Operations exclude: false alter: alter_text: false @@ -679,14 +422,15 @@ display: 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 + edit_group_relationship: edit_group_relationship + delete_group_relationship: delete_group_relationship + view_group_relationship: view_group_relationship name: '0' bundle: '0' status: '0' + uid: '0' pager: type: mini options: @@ -729,10 +473,10 @@ display: id: gid table: group_relationship_field_data field: gid - relationship: group_content + relationship: group_relationship group_type: group admin_label: '' - entity_type: group_content + entity_type: group_relationship entity_field: gid plugin_id: group_id default_action: ignore @@ -956,19 +700,19 @@ display: replica: false query_tags: {} relationships: - group_content: - id: group_content + group_relationship: + id: group_relationship table: media_field_data - field: group_content + field: group_relationship relationship: none group_type: group - admin_label: 'Media group content' + admin_label: 'Media group relationship' entity_type: media - plugin_id: group_content_to_entity_reverse + plugin_id: group_relationship_to_entity_reverse required: false - group_content_plugins: + group_relation_plugins: 'group_media:audio': '0' - 'group_media:file': '0' + 'group_media:document': '0' 'group_media:image': '0' 'group_media:remote_video': '0' 'group_media:video': '0' diff --git a/modules/collabora_online_group/tests/src/Functional/InstallationTest.php b/modules/collabora_online_group/tests/src/Functional/InstallationTest.php deleted file mode 100644 index b5dce8f2..00000000 --- a/modules/collabora_online_group/tests/src/Functional/InstallationTest.php +++ /dev/null @@ -1,35 +0,0 @@ -drupalGet(''); - $this->assertSession()->statusCodeEquals(200); - } - -} diff --git a/modules/collabora_online_group/tests/src/Functional/ViewTest.php b/modules/collabora_online_group/tests/src/Functional/ViewTest.php new file mode 100644 index 00000000..58f75b2f --- /dev/null +++ b/modules/collabora_online_group/tests/src/Functional/ViewTest.php @@ -0,0 +1,142 @@ +createGroupType(['id' => 'group_type_1']); + $media_type = $this->createMediaType('file', ['id' => 'document']); + $this->createGroupRole([ + 'group_type' => 'group_type_1', + 'scope' => PermissionScopeInterface::INSIDER_ID, + 'global_role' => RoleInterface::AUTHENTICATED_ID, + 'permissions' => [ + 'view group', + 'access group_media overview', + 'view group_media:document entity', + 'edit any group_media:document in collabora', + 'preview group_media:document in collabora', + ], + ]); + $this->createPluginRelation($group_type, 'group_media:document', [ + 'group_cardinality' => 0, + 'entity_cardinality' => 1, + 'use_creation_wizard' => FALSE, + ]); + + // Create content. + $group = $this->createGroup(['type' => 'group_type_1']); + for ($i = 1;$i < 4;$i++) { + $media = $this->createMediaEntity('document', [ + 'id' => 'media_' . $i, + 'name' => 'Media ' . $i, + ]); + $group->addRelationship($media, 'group_media:document'); + } + $user = $this->createUser([ + 'view the administration theme', + 'access administration pages', + 'access group overview', + ]); + $group->addMember($user); + + // Go to the page and check the links added to the view. + $this->drupalLogin($user); + $this->drupalGet("group/{$group->id()}/media"); + $assert_session = $this->assertSession(); + + // Check table header. + $table = $assert_session->elementExists('css', 'table'); + $table_header = $assert_session->elementExists('css', 'thead', $table); + $rows = $table_header->findAll('css', 'tr'); + $cols = $rows[0]->findAll('css', 'th'); + $this->assertEquals('Media name', $cols[0]->getText()); + $this->assertEquals('Bundle', $cols[1]->getText()); + $this->assertEquals('Status', $cols[2]->getText()); + $this->assertEquals('Publisher', $cols[3]->getText()); + $this->assertEquals('Operations', $cols[4]->getText()); + + // Check that rows contain new links for operations in Collabora. + $table_body = $assert_session->elementExists('css', 'tbody', $table); + $rows = $table_body->findAll('css', 'tr'); + $i = 0; + foreach(Media::loadMultiple() as $media) { + $cols = $rows[$i]->findAll('css', 'td'); + $this->assertEquals($media->getName(), $cols[0]->getText()); + $this->assertEquals($media_type->label(), $cols[1]->getText()); + $this->assertEquals('Yes', $cols[2]->getText()); + $this->assertEquals('Anonymous', $cols[3]->getText()); + $operation_links = $cols[4]->findAll('css', 'a'); + $this->assertEquals('Preview in Collabora', $operation_links[0]->getText()); + $this->assertEquals( + Url::fromRoute( + 'collabora-online.view', + [ + 'media' => $media->id() + ], + [ + 'query' => [ + 'destination' => "/group/{$group->id()}/media", + ] + ] + )->toString(), + $operation_links[0]->getAttribute('href') + ); + $this->assertEquals('Edit in Collabora', $operation_links[1]->getText()); + $this->assertEquals( + Url::fromRoute( + 'collabora-online.edit', + [ + 'media' => $media->id() + ], + [ + 'query' => [ + 'destination' => "/group/{$group->id()}/media", + ] + ] + )->toString(), + $operation_links[1]->getAttribute('href') + ); + $i++; + } + } + +} From fe0d58409aab65bf6b157c6013303f5925e7a2f5 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Mon, 18 Nov 2024 09:34:11 +0100 Subject: [PATCH 05/21] Issue CollaboraOnline/collabora-drupal#52: Support for groupmedia 3 and 4. --- .../collabora_online_group.install | 8 +- .../override/views.view.group_media-3.yml | 1017 +++++++++++++++++ 2 files changed, 1024 insertions(+), 1 deletion(-) create mode 100644 modules/collabora_online_group/config/override/views.view.group_media-3.yml diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index 8ff48a95..04f14000 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -12,11 +12,17 @@ function collabora_online_group_install(): void { ) { // Update view with module configuration. $name = 'views.view.group_media'; + + // Fallback for older versions. + if (\Drupal::entityTypeManager()->getDefinition('group_relationship_type', FALSE) === NULL) { + $name = 'views.view.group_media-3'; + } + $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); + $active_storage->write('views.view.group_media', $config); } } diff --git a/modules/collabora_online_group/config/override/views.view.group_media-3.yml b/modules/collabora_online_group/config/override/views.view.group_media-3.yml new file mode 100644 index 00000000..4bed5cad --- /dev/null +++ b/modules/collabora_online_group/config/override/views.view.group_media-3.yml @@ -0,0 +1,1017 @@ +uuid: null +langcode: en +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: + id: default + display_title: Master + display_plugin: default + 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 + 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' + 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' + 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: 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 + destination: true + fields: + view_group_content: view_group_content + edit_group_content: edit_group_content + delete_group_content: delete_group_content + collabora_preview: collabora_preview + collabora_edit: collabora_edit + edit_media: edit_media + delete_media: delete_media + name: '0' + bundle: '0' + status: '0' + uid: '0' + pager: + type: mini + options: + offset: 0 + pagination_heading_level: h4 + 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: '' + 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: {} From 36e80e73829ff407cbf83c9493c1ce53bf388b37 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Mon, 18 Nov 2024 11:38:13 +0100 Subject: [PATCH 06/21] Issue CollaboraOnline/collabora-drupal#52: Replace config with view display modification. --- .../collabora_online_group.install | 51 +- .../override/views.view.group_media-3.yml | 1017 ----------------- .../override/views.view.group_media.yml | 758 ------------ 3 files changed, 37 insertions(+), 1789 deletions(-) delete mode 100644 modules/collabora_online_group/config/override/views.view.group_media-3.yml delete mode 100644 modules/collabora_online_group/config/override/views.view.group_media.yml diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index 04f14000..ae540a8d 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -1,6 +1,6 @@ moduleExists('views') && - \Drupal::entityTypeManager()->getStorage('view')->load('group_media') + $view = View::load('group_media') ) { - // Update view with module configuration. - $name = 'views.view.group_media'; - - // Fallback for older versions. - if (\Drupal::entityTypeManager()->getDefinition('group_relationship_type', FALSE) === NULL) { - $name = 'views.view.group_media-3'; + // Load display and apply changes. + $display = &$view->getDisplay('default'); + if ($display === NULL) { + return; } - $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('views.view.group_media', $config); + // Add new fields to the display. + $display['display_options']['fields'] += [ + 'collabora_preview' => [ + 'id' => 'collabora_preview', + 'table' => 'media', + 'field'=> 'collabora_preview', + 'plugin_id' => 'media_collabora_preview', + 'label' => '', + 'exclude' => TRUE, + 'text' => t('Preview in Collabora'), + ]]; + $display['display_options']['fields'] += [ + 'collabora_edit' => [ + 'id' => 'collabora_edit', + 'table' => 'media', + 'field'=> 'collabora_edit', + 'plugin_id' => 'media_collabora_edit', + 'label' => '', + 'exclude' => TRUE, + 'text' => t('Edit in Collabora'), + ]]; + // Add new fields as options for the dropbutton and move the element to the end. + $dropbutton = $display['display_options']['fields']['dropbutton']; + $dropbutton['fields'] += [ + 'collabora_preview' => 'collabora_preview', + 'collabora_edit' => 'collabora_edit', + ]; + unset($display['display_options']['fields']['dropbutton']); + $display['display_options']['fields']['dropbutton'] = $dropbutton; + + $view->save(); } } diff --git a/modules/collabora_online_group/config/override/views.view.group_media-3.yml b/modules/collabora_online_group/config/override/views.view.group_media-3.yml deleted file mode 100644 index 4bed5cad..00000000 --- a/modules/collabora_online_group/config/override/views.view.group_media-3.yml +++ /dev/null @@ -1,1017 +0,0 @@ -uuid: null -langcode: en -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: - id: default - display_title: Master - display_plugin: default - 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 - 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' - 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' - 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: 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 - destination: true - fields: - view_group_content: view_group_content - edit_group_content: edit_group_content - delete_group_content: delete_group_content - collabora_preview: collabora_preview - collabora_edit: collabora_edit - edit_media: edit_media - delete_media: delete_media - name: '0' - bundle: '0' - status: '0' - uid: '0' - pager: - type: mini - options: - offset: 0 - pagination_heading_level: h4 - 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: '' - 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/config/override/views.view.group_media.yml b/modules/collabora_online_group/config/override/views.view.group_media.yml deleted file mode 100644 index 0db5c082..00000000 --- a/modules/collabora_online_group/config/override/views.view.group_media.yml +++ /dev/null @@ -1,758 +0,0 @@ -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' - dropbutton: - id: dropbutton - table: views - field: dropbutton - relationship: none - group_type: group - admin_label: '' - plugin_id: dropbutton - 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 - destination: true - fields: - collabora_preview: collabora_preview - collabora_edit: collabora_edit - edit_media: edit_media - delete_media: delete_media - edit_group_relationship: edit_group_relationship - delete_group_relationship: delete_group_relationship - view_group_relationship: view_group_relationship - name: '0' - bundle: '0' - status: '0' - uid: '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_relationship - group_type: group - admin_label: '' - entity_type: group_relationship - 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_relationship: - id: group_relationship - table: media_field_data - field: group_relationship - relationship: none - group_type: group - admin_label: 'Media group relationship' - entity_type: media - plugin_id: group_relationship_to_entity_reverse - required: false - group_relation_plugins: - 'group_media:audio': '0' - 'group_media:document': '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: {} From f2a6ce1b7d332d3027e74ba0ec05f2b4e92b6a93 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Mon, 18 Nov 2024 12:02:52 +0100 Subject: [PATCH 07/21] Issue CollaboraOnline/collabora-drupal#52: Supoprt for different versions in test. --- .../tests/src/Functional/ViewTest.php | 3 ++- .../tests/src/Traits/GroupRelationTrait.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/collabora_online_group/tests/src/Functional/ViewTest.php b/modules/collabora_online_group/tests/src/Functional/ViewTest.php index 58f75b2f..834ecb9d 100644 --- a/modules/collabora_online_group/tests/src/Functional/ViewTest.php +++ b/modules/collabora_online_group/tests/src/Functional/ViewTest.php @@ -92,7 +92,8 @@ public function testViewLinks(): void { $this->assertEquals('Bundle', $cols[1]->getText()); $this->assertEquals('Status', $cols[2]->getText()); $this->assertEquals('Publisher', $cols[3]->getText()); - $this->assertEquals('Operations', $cols[4]->getText()); + // Support for different vesrions of groupmedia. + $this->assertEquals($this->isGroupRelationShipType() ? 'Operations' : 'Dropbutton', $cols[4]->getText()); // Check that rows contain new links for operations in Collabora. $table_body = $assert_session->elementExists('css', 'tbody', $table); diff --git a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php index 807353bf..c3f6c7e6 100644 --- a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php +++ b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php @@ -31,7 +31,7 @@ protected function createPluginRelation(GroupTypeInterface $group_type, string $ $entity_type_id = 'group_relationship_type'; // Fallback for older versions. - if ($this->entityTypeManager()->getDefinition($entity_type_id, FALSE) === NULL) { + if (!$this->isGroupRelationShipType()) { $entity_type_id = 'group_content_type'; } @@ -43,4 +43,14 @@ protected function createPluginRelation(GroupTypeInterface $group_type, string $ return $entity; } + /** + * Checks if 'group_relationship_type' group type entity exists. + * + * @return bool + * If the entity type exists. + */ + protected function isGroupRelationshipType(): bool { + return ($this->entityTypeManager()->getDefinition('group_relationship_type', FALSE) !== NULL); + } + } From f417fd514dd49196f0cd449d205ab52ac531a163 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 16:22:32 +0100 Subject: [PATCH 08/21] Issue CollaboraOnline/collabora-drupal#52: Code formatting and documentation fixes. --- collabora_online.views.inc | 8 +- .../collabora_online_group.install | 20 ++-- .../tests/src/Functional/ViewTest.php | 8 +- .../tests/src/Traits/GroupRelationTrait.php | 2 +- src/Plugin/views/field/CollaboraEdit.php | 2 +- src/Plugin/views/field/CollaboraPreview.php | 4 +- tests/src/Kernel/ViewsLinkFieldsTest.php | 95 ++++++++++--------- 7 files changed, 74 insertions(+), 65 deletions(-) diff --git a/collabora_online.views.inc b/collabora_online.views.inc index 956ca91c..18d0e7e6 100644 --- a/collabora_online.views.inc +++ b/collabora_online.views.inc @@ -6,18 +6,18 @@ declare(strict_types=1); * Implements hook_views_data_alter(). */ function collabora_online_views_data_alter(array &$data): void { - $data['media']['collabora_preview'] = [ + $data['media']['collabora_preview'] = [ 'title' => t('Preview operation in collabora'), 'group' => t('Media'), - 'field' => [ + 'field' => [ 'title' => t('Media preview in collabora'), 'id' => 'media_collabora_preview', ], ]; - $data['media']['collabora_edit'] = [ + $data['media']['collabora_edit'] = [ 'title' => t('Edit operation in collabora'), 'group' => t('Media'), - 'field' => [ + 'field' => [ 'title' => t('Media edit in collabora'), 'id' => 'media_collabora_edit', ], diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index ae540a8d..0a506c1f 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -21,22 +21,22 @@ function collabora_online_group_install(): void { 'collabora_preview' => [ 'id' => 'collabora_preview', 'table' => 'media', - 'field'=> 'collabora_preview', + 'field' => 'collabora_preview', 'plugin_id' => 'media_collabora_preview', 'label' => '', 'exclude' => TRUE, 'text' => t('Preview in Collabora'), - ]]; + ]]; $display['display_options']['fields'] += [ 'collabora_edit' => [ - 'id' => 'collabora_edit', - 'table' => 'media', - 'field'=> 'collabora_edit', - 'plugin_id' => 'media_collabora_edit', - 'label' => '', - 'exclude' => TRUE, - 'text' => t('Edit in Collabora'), - ]]; + 'id' => 'collabora_edit', + 'table' => 'media', + 'field' => 'collabora_edit', + 'plugin_id' => 'media_collabora_edit', + 'label' => '', + 'exclude' => TRUE, + 'text' => t('Edit in Collabora'), + ]]; // Add new fields as options for the dropbutton and move the element to the end. $dropbutton = $display['display_options']['fields']['dropbutton']; $dropbutton['fields'] += [ diff --git a/modules/collabora_online_group/tests/src/Functional/ViewTest.php b/modules/collabora_online_group/tests/src/Functional/ViewTest.php index 834ecb9d..07491943 100644 --- a/modules/collabora_online_group/tests/src/Functional/ViewTest.php +++ b/modules/collabora_online_group/tests/src/Functional/ViewTest.php @@ -54,7 +54,7 @@ public function testViewLinks(): void { 'view group_media:document entity', 'edit any group_media:document in collabora', 'preview group_media:document in collabora', - ], + ], ]); $this->createPluginRelation($group_type, 'group_media:document', [ 'group_cardinality' => 0, @@ -64,7 +64,7 @@ public function testViewLinks(): void { // Create content. $group = $this->createGroup(['type' => 'group_type_1']); - for ($i = 1;$i < 4;$i++) { + for ($i = 1; $i < 4; $i++) { $media = $this->createMediaEntity('document', [ 'id' => 'media_' . $i, 'name' => 'Media ' . $i, @@ -93,13 +93,13 @@ public function testViewLinks(): void { $this->assertEquals('Status', $cols[2]->getText()); $this->assertEquals('Publisher', $cols[3]->getText()); // Support for different vesrions of groupmedia. - $this->assertEquals($this->isGroupRelationShipType() ? 'Operations' : 'Dropbutton', $cols[4]->getText()); + $this->assertEquals($this->isGroupRelationshipType() ? 'Operations' : 'Dropbutton', $cols[4]->getText()); // Check that rows contain new links for operations in Collabora. $table_body = $assert_session->elementExists('css', 'tbody', $table); $rows = $table_body->findAll('css', 'tr'); $i = 0; - foreach(Media::loadMultiple() as $media) { + foreach (Media::loadMultiple() as $media) { $cols = $rows[$i]->findAll('css', 'td'); $this->assertEquals($media->getName(), $cols[0]->getText()); $this->assertEquals($media_type->label(), $cols[1]->getText()); diff --git a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php index c3f6c7e6..69e380e6 100644 --- a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php +++ b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php @@ -31,7 +31,7 @@ protected function createPluginRelation(GroupTypeInterface $group_type, string $ $entity_type_id = 'group_relationship_type'; // Fallback for older versions. - if (!$this->isGroupRelationShipType()) { + if (!$this->isGroupRelationshipType()) { $entity_type_id = 'group_content_type'; } diff --git a/src/Plugin/views/field/CollaboraEdit.php b/src/Plugin/views/field/CollaboraEdit.php index 26add133..420cb287 100644 --- a/src/Plugin/views/field/CollaboraEdit.php +++ b/src/Plugin/views/field/CollaboraEdit.php @@ -18,7 +18,7 @@ */ class CollaboraEdit extends LinkBase { - protected function getUrlInfo(ResultRow $row): Url|NULL { + protected function getUrlInfo(ResultRow $row): Url|null { /** @var \Drupal\media\MediaInterface $entity */ $entity = $this->getEntity($row); diff --git a/src/Plugin/views/field/CollaboraPreview.php b/src/Plugin/views/field/CollaboraPreview.php index 1b0e4cb3..ed0544c7 100644 --- a/src/Plugin/views/field/CollaboraPreview.php +++ b/src/Plugin/views/field/CollaboraPreview.php @@ -18,8 +18,8 @@ */ class CollaboraPreview extends LinkBase { - protected function getUrlInfo(ResultRow $row): Url|NULL { - /** @var \Drupal\media\MediaInterface $entity */ + protected function getUrlInfo(ResultRow $row): Url|null { + /** @var \Drupal\media\MediaInterface $entity */ $entity = $this->getEntity($row); if ($entity === NULL) { diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php index 5ccdbf08..bdb4e42e 100644 --- a/tests/src/Kernel/ViewsLinkFieldsTest.php +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -55,13 +55,14 @@ protected function setUp(): void { $this->installEntitySchema('user'); $this->installConfig(['user', 'views', 'collabora_online_test']); $this->installSchema('file', ['file_usage']); - // Install user module avoid user 1 permissions bypass. + // Install user module to avoid user 1 permissions bypass. \Drupal::moduleHandler()->loadInclude('user', 'install'); user_install(); // Create two medias to check access with different scopes, 'any' and 'own'. $this->createMediaEntity('document'); - $this->ownMedia = $this->createMediaEntity('document');; + $this->ownMedia = $this->createMediaEntity('document'); + ; } /** @@ -69,46 +70,54 @@ protected function setUp(): void { */ public function testLinks(): void { // User without permissions can't see links. - $this->doTestLinks([ - 'preview' => [FALSE, FALSE], - 'edit' => [FALSE, FALSE], - ], - $this->createUser([])); + $this->doTestLinks( + [ + 'preview' => [FALSE, FALSE], + 'edit' => [FALSE, FALSE], + ], + $this->createUser([]) + ); // User with 'Preview' permission can see preview link. - $this->doTestLinks([ - 'preview' => [TRUE, TRUE], - 'edit' => [FALSE, FALSE], - ], - $this->createUser([ - 'preview document in collabora' - ])); + $this->doTestLinks( + [ + 'preview' => [TRUE, TRUE], + 'edit' => [FALSE, FALSE], + ], + $this->createUser([ + 'preview document in collabora' + ]) + ); // User with 'Edit any' permission can see edit link. - $this->doTestLinks([ - 'preview' => [FALSE, FALSE], - 'edit' => [TRUE, TRUE], - ], - $this->createUser([ - 'edit any document in collabora' - ])); + $this->doTestLinks( + [ + 'preview' => [FALSE, FALSE], + 'edit' => [TRUE, TRUE], + ], + $this->createUser([ + 'edit any document in collabora' + ]) + ); // User with 'Edit own' permission can see edit link for entities they own. - $this->doTestLinks([ - 'preview' => [FALSE, FALSE], - 'edit' => [FALSE, TRUE], - ], - $this->createUser([ - 'edit own document in collabora' - ])); + $this->doTestLinks( + [ + 'preview' => [FALSE, FALSE], + 'edit' => [FALSE, TRUE], + ], + $this->createUser([ + 'edit own document in collabora' + ]) + ); } /** * Tests that links behave as expected. * - * @param [] $expected_results + * @param array $expected_results * An associative array of expected results keyed by operation. * @param \Drupal\Core\Session\AccountInterface $account - * The user account to be used to run the test; + * The user account to be used to run the test. */ - protected function doTestLinks(array $expected_results, AccountInterface $account) { + protected function doTestLinks(array $expected_results, AccountInterface $account): void { $this->setCurrentUser(account: $account); // Set the current user as the owner to check 'edit own' access. $this->ownMedia->setOwnerId($account->id())->save(); @@ -116,21 +125,21 @@ protected function doTestLinks(array $expected_results, AccountInterface $accoun $view->preview(); $info = [ - 'preview' => [ - 'label' => 'Preview in Collabora', - 'field_id' => 'collabora_preview', - 'route' => 'collabora-online.view' - ], - 'edit' => [ - 'label' => 'Edit in Collabora', - 'field_id' => 'collabora_edit', - 'route' => 'collabora-online.edit' - ], + 'preview' => [ + 'label' => 'Preview in Collabora', + 'field_id' => 'collabora_preview', + 'route' => 'collabora-online.view' + ], + 'edit' => [ + 'label' => 'Edit in Collabora', + 'field_id' => 'collabora_edit', + 'route' => 'collabora-online.edit' + ], ]; $i = 0; // Check each expected results for every media. - foreach(Media::loadMultiple() as $media) { + foreach (Media::loadMultiple() as $media) { foreach ($expected_results as $operation => $expected_result) { $expected_link = ''; // The operation array contains results for each of the entities. @@ -142,7 +151,7 @@ protected function doTestLinks(array $expected_results, AccountInterface $accoun $link = $view->style_plugin->getField($i, $info[$operation]['field_id']); $this->assertEquals($expected_link, (string) $link); } - $i++; + $i++; } } From ab6a60a8f5e7e13fbc65b9d8fbe9b13bcc204ee5 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 16:53:44 +0100 Subject: [PATCH 09/21] Issue CollaboraOnline/collabora-drupal#52: Change field label. --- collabora_online.views.inc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/collabora_online.views.inc b/collabora_online.views.inc index 18d0e7e6..fff2b5b6 100644 --- a/collabora_online.views.inc +++ b/collabora_online.views.inc @@ -7,18 +7,16 @@ declare(strict_types=1); */ function collabora_online_views_data_alter(array &$data): void { $data['media']['collabora_preview'] = [ - 'title' => t('Preview operation in collabora'), + 'title' => t('Link to preview in Collabora'), 'group' => t('Media'), 'field' => [ - 'title' => t('Media preview in collabora'), 'id' => 'media_collabora_preview', ], ]; $data['media']['collabora_edit'] = [ - 'title' => t('Edit operation in collabora'), + 'title' => t('Link to edit in Collabora'), 'group' => t('Media'), 'field' => [ - 'title' => t('Media edit in collabora'), 'id' => 'media_collabora_edit', ], ]; From 281d0cdb9a8265994145506cc23ca8ab32ed3838 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 17:39:29 +0100 Subject: [PATCH 10/21] Issue CollaboraOnline/collabora-drupal#52: Early return for module isntall. --- .../collabora_online_group.install | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index 0a506c1f..03092a7d 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -7,45 +7,47 @@ use Drupal\views\Entity\View; */ function collabora_online_group_install(): void { if ( - \Drupal::moduleHandler()->moduleExists('views') && - $view = View::load('group_media') + !\Drupal::moduleHandler()->moduleExists('views') || + !($view = View::load('group_media')) ) { - // Load display and apply changes. - $display = &$view->getDisplay('default'); - if ($display === NULL) { - return; - } - - // Add new fields to the display. - $display['display_options']['fields'] += [ - 'collabora_preview' => [ - 'id' => 'collabora_preview', - 'table' => 'media', - 'field' => 'collabora_preview', - 'plugin_id' => 'media_collabora_preview', - 'label' => '', - 'exclude' => TRUE, - 'text' => t('Preview in Collabora'), - ]]; - $display['display_options']['fields'] += [ - 'collabora_edit' => [ - 'id' => 'collabora_edit', - 'table' => 'media', - 'field' => 'collabora_edit', - 'plugin_id' => 'media_collabora_edit', - 'label' => '', - 'exclude' => TRUE, - 'text' => t('Edit in Collabora'), - ]]; - // Add new fields as options for the dropbutton and move the element to the end. - $dropbutton = $display['display_options']['fields']['dropbutton']; - $dropbutton['fields'] += [ - 'collabora_preview' => 'collabora_preview', - 'collabora_edit' => 'collabora_edit', - ]; - unset($display['display_options']['fields']['dropbutton']); - $display['display_options']['fields']['dropbutton'] = $dropbutton; + return; + } - $view->save(); + // Load display and apply changes. + $display = &$view->getDisplay('default'); + if ($display === NULL) { + return; } + + // Add new fields to the display. + $display['display_options']['fields'] += [ + 'collabora_preview' => [ + 'id' => 'collabora_preview', + 'table' => 'media', + 'field' => 'collabora_preview', + 'plugin_id' => 'media_collabora_preview', + 'label' => '', + 'exclude' => TRUE, + 'text' => t('Preview in Collabora'), + ]]; + $display['display_options']['fields'] += [ + 'collabora_edit' => [ + 'id' => 'collabora_edit', + 'table' => 'media', + 'field' => 'collabora_edit', + 'plugin_id' => 'media_collabora_edit', + 'label' => '', + 'exclude' => TRUE, + 'text' => t('Edit in Collabora'), + ]]; + // Add new fields as options for the dropbutton and move the element to the end. + $dropbutton = $display['display_options']['fields']['dropbutton']; + $dropbutton['fields'] += [ + 'collabora_preview' => 'collabora_preview', + 'collabora_edit' => 'collabora_edit', + ]; + unset($display['display_options']['fields']['dropbutton']); + $display['display_options']['fields']['dropbutton'] = $dropbutton; + + $view->save(); } From d58bee7112c1b9529ea29528d4ef09cf1f704c64 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 17:14:36 +0100 Subject: [PATCH 11/21] Issue CollaboraOnline/collabora-drupal#52: Module is syncing. --- modules/collabora_online_group/collabora_online_group.install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index 03092a7d..7ae5919d 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -5,8 +5,9 @@ use Drupal\views\Entity\View; /** * Implements hook_install(). */ -function collabora_online_group_install(): void { +function collabora_online_group_install(bool $is_syncing): void { if ( + $is_syncing || !\Drupal::moduleHandler()->moduleExists('views') || !($view = View::load('group_media')) ) { From ce4b9137601374f0ca9fd9c16677148b2006648d Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 17:29:47 +0100 Subject: [PATCH 12/21] Issue CollaboraOnline/collabora-drupal#52: Missing docs. --- src/Plugin/views/field/CollaboraEdit.php | 3 +++ src/Plugin/views/field/CollaboraPreview.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Plugin/views/field/CollaboraEdit.php b/src/Plugin/views/field/CollaboraEdit.php index 420cb287..e78ba9dd 100644 --- a/src/Plugin/views/field/CollaboraEdit.php +++ b/src/Plugin/views/field/CollaboraEdit.php @@ -18,6 +18,9 @@ */ class CollaboraEdit extends LinkBase { + /** + * {@inheritdoc} + */ protected function getUrlInfo(ResultRow $row): Url|null { /** @var \Drupal\media\MediaInterface $entity */ $entity = $this->getEntity($row); diff --git a/src/Plugin/views/field/CollaboraPreview.php b/src/Plugin/views/field/CollaboraPreview.php index ed0544c7..9c47f431 100644 --- a/src/Plugin/views/field/CollaboraPreview.php +++ b/src/Plugin/views/field/CollaboraPreview.php @@ -18,6 +18,9 @@ */ class CollaboraPreview extends LinkBase { + /** + * {@inheritdoc} + */ protected function getUrlInfo(ResultRow $row): Url|null { /** @var \Drupal\media\MediaInterface $entity */ $entity = $this->getEntity($row); From b2a73aaf51610d5d2b802d53c4032b11133743d2 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 17:30:08 +0100 Subject: [PATCH 13/21] Issue CollaboraOnline/collabora-drupal#52: Rename views test. --- .../src/Functional/{ViewTest.php => GroupMediaViewsTest.php} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename modules/collabora_online_group/tests/src/Functional/{ViewTest.php => GroupMediaViewsTest.php} (97%) diff --git a/modules/collabora_online_group/tests/src/Functional/ViewTest.php b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php similarity index 97% rename from modules/collabora_online_group/tests/src/Functional/ViewTest.php rename to modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php index 07491943..e376e1f1 100644 --- a/modules/collabora_online_group/tests/src/Functional/ViewTest.php +++ b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php @@ -15,9 +15,9 @@ use Drupal\user\RoleInterface; /** - * Test the provided view by the module. + * Test the modifications performend in groupmedia view by the module. */ -class ViewTest extends BrowserTestBase { +class GroupMediaViewsTest extends BrowserTestBase { use MediaCreationTrait; use GroupRelationTrait; From 596435791c831f9364fa2482c93e98f2c5a12143 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Wed, 20 Nov 2024 08:26:33 +0100 Subject: [PATCH 14/21] Issue CollaboraOnline/collabora-drupal#52: PHP attributes for plugin. --- src/Plugin/views/field/CollaboraEdit.php | 4 ++-- src/Plugin/views/field/CollaboraPreview.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Plugin/views/field/CollaboraEdit.php b/src/Plugin/views/field/CollaboraEdit.php index e78ba9dd..56bedf4c 100644 --- a/src/Plugin/views/field/CollaboraEdit.php +++ b/src/Plugin/views/field/CollaboraEdit.php @@ -6,6 +6,7 @@ use Drupal\collabora_online\Cool\CoolUtils; use Drupal\Core\Url; +use Drupal\views\Attribute\ViewsField; use Drupal\views\Plugin\views\field\LinkBase; use Drupal\views\ResultRow; @@ -13,9 +14,8 @@ * Field handler for link to edit a collabora file. * * @ingroup views_field_handlers - * - * @ViewsField("media_collabora_edit") */ +#[ViewsField('media_collabora_edit')] class CollaboraEdit extends LinkBase { /** diff --git a/src/Plugin/views/field/CollaboraPreview.php b/src/Plugin/views/field/CollaboraPreview.php index 9c47f431..a0d24411 100644 --- a/src/Plugin/views/field/CollaboraPreview.php +++ b/src/Plugin/views/field/CollaboraPreview.php @@ -6,6 +6,7 @@ use Drupal\collabora_online\Cool\CoolUtils; use Drupal\Core\Url; +use Drupal\views\Attribute\ViewsField; use Drupal\views\Plugin\views\field\LinkBase; use Drupal\views\ResultRow; @@ -13,9 +14,8 @@ * Field handler for link to preview a collabora file. * * @ingroup views_field_handlers - * - * @ViewsField("media_collabora_preview") */ +#[ViewsField('media_collabora_preview')] class CollaboraPreview extends LinkBase { /** From 051947bb669cc666b5ce83e03fb38c13eecff441 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Tue, 19 Nov 2024 17:37:22 +0100 Subject: [PATCH 15/21] Issue CollaboraOnline/collabora-drupal#52: Remove named parameter. --- tests/src/Kernel/ViewsLinkFieldsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php index bdb4e42e..3c72b5e1 100644 --- a/tests/src/Kernel/ViewsLinkFieldsTest.php +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -118,7 +118,7 @@ public function testLinks(): void { * The user account to be used to run the test. */ protected function doTestLinks(array $expected_results, AccountInterface $account): void { - $this->setCurrentUser(account: $account); + $this->setCurrentUser($account); // Set the current user as the owner to check 'edit own' access. $this->ownMedia->setOwnerId($account->id())->save(); $view = Views::getView('test_collabora_links'); From 4c13b26bd9605fae5aa73057e86c74dd5cf50332 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Wed, 20 Nov 2024 10:59:41 +0100 Subject: [PATCH 16/21] Issue CollaboraOnline/collabora-drupal#52: Drop version function. --- .../tests/src/Functional/GroupMediaViewsTest.php | 2 +- .../tests/src/Traits/GroupRelationTrait.php | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php index e376e1f1..0db5e3d5 100644 --- a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php +++ b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php @@ -93,7 +93,7 @@ public function testViewLinks(): void { $this->assertEquals('Status', $cols[2]->getText()); $this->assertEquals('Publisher', $cols[3]->getText()); // Support for different vesrions of groupmedia. - $this->assertEquals($this->isGroupRelationshipType() ? 'Operations' : 'Dropbutton', $cols[4]->getText()); + $this->assertTrue(in_array($cols[4]->getText(), ['Operations', 'Dropbutton'])); // Check that rows contain new links for operations in Collabora. $table_body = $assert_session->elementExists('css', 'tbody', $table); diff --git a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php index 69e380e6..b66dc3d2 100644 --- a/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php +++ b/modules/collabora_online_group/tests/src/Traits/GroupRelationTrait.php @@ -31,7 +31,7 @@ protected function createPluginRelation(GroupTypeInterface $group_type, string $ $entity_type_id = 'group_relationship_type'; // Fallback for older versions. - if (!$this->isGroupRelationshipType()) { + if ($this->entityTypeManager()->getDefinition($entity_type_id, FALSE) === NULL) { $entity_type_id = 'group_content_type'; } @@ -43,14 +43,4 @@ protected function createPluginRelation(GroupTypeInterface $group_type, string $ return $entity; } - /** - * Checks if 'group_relationship_type' group type entity exists. - * - * @return bool - * If the entity type exists. - */ - protected function isGroupRelationshipType(): bool { - return ($this->entityTypeManager()->getDefinition('group_relationship_type', FALSE) !== NULL); - } - } From dc378281871ae04bd42421f6a5e1f8bdcbf3fe15 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Wed, 20 Nov 2024 10:41:56 +0100 Subject: [PATCH 17/21] Issue CollaboraOnline/collabora-drupal#52: Change preview links label. --- collabora_online.views.inc | 4 ++-- config/schema/collabora_online.schema.yml | 2 +- .../collabora_online_group.install | 10 ++++++---- .../tests/src/Functional/GroupMediaViewsTest.php | 4 ++-- .../optional/views.view.test_collabora_links.yml | 4 ++-- tests/src/Kernel/ViewsLinkFieldsTest.php | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/collabora_online.views.inc b/collabora_online.views.inc index fff2b5b6..1e3d8302 100644 --- a/collabora_online.views.inc +++ b/collabora_online.views.inc @@ -7,14 +7,14 @@ declare(strict_types=1); */ function collabora_online_views_data_alter(array &$data): void { $data['media']['collabora_preview'] = [ - 'title' => t('Link to preview in Collabora'), + 'title' => t('Link to view in Collabora Online'), 'group' => t('Media'), 'field' => [ 'id' => 'media_collabora_preview', ], ]; $data['media']['collabora_edit'] = [ - 'title' => t('Link to edit in Collabora'), + 'title' => t('Link to edit in Collabora Online'), 'group' => t('Media'), 'field' => [ 'id' => 'media_collabora_edit', diff --git a/config/schema/collabora_online.schema.yml b/config/schema/collabora_online.schema.yml index 6d16d9de..9b2093ea 100644 --- a/config/schema/collabora_online.schema.yml +++ b/config/schema/collabora_online.schema.yml @@ -27,7 +27,7 @@ collabora_online.settings: views.field.media_collabora_preview: type: views_field - label: 'Collabora preview link' + label: 'Collabora view link' mapping: text: type: label diff --git a/modules/collabora_online_group/collabora_online_group.install b/modules/collabora_online_group/collabora_online_group.install index 7ae5919d..8ec5580b 100644 --- a/modules/collabora_online_group/collabora_online_group.install +++ b/modules/collabora_online_group/collabora_online_group.install @@ -29,8 +29,9 @@ function collabora_online_group_install(bool $is_syncing): void { 'plugin_id' => 'media_collabora_preview', 'label' => '', 'exclude' => TRUE, - 'text' => t('Preview in Collabora'), - ]]; + 'text' => t('View in Collabora Online'), + ], + ]; $display['display_options']['fields'] += [ 'collabora_edit' => [ 'id' => 'collabora_edit', @@ -39,8 +40,9 @@ function collabora_online_group_install(bool $is_syncing): void { 'plugin_id' => 'media_collabora_edit', 'label' => '', 'exclude' => TRUE, - 'text' => t('Edit in Collabora'), - ]]; + 'text' => t('Edit in Collabora Online'), + ], + ]; // Add new fields as options for the dropbutton and move the element to the end. $dropbutton = $display['display_options']['fields']['dropbutton']; $dropbutton['fields'] += [ diff --git a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php index 0db5e3d5..a67c6a3e 100644 --- a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php +++ b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php @@ -106,7 +106,7 @@ public function testViewLinks(): void { $this->assertEquals('Yes', $cols[2]->getText()); $this->assertEquals('Anonymous', $cols[3]->getText()); $operation_links = $cols[4]->findAll('css', 'a'); - $this->assertEquals('Preview in Collabora', $operation_links[0]->getText()); + $this->assertEquals('View in Collabora Online', $operation_links[0]->getText()); $this->assertEquals( Url::fromRoute( 'collabora-online.view', @@ -121,7 +121,7 @@ public function testViewLinks(): void { )->toString(), $operation_links[0]->getAttribute('href') ); - $this->assertEquals('Edit in Collabora', $operation_links[1]->getText()); + $this->assertEquals('Edit in Collabora Online', $operation_links[1]->getText()); $this->assertEquals( Url::fromRoute( 'collabora-online.edit', diff --git a/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml index e5c96ff1..58fd87ac 100644 --- a/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml +++ b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml @@ -117,7 +117,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - text: "Preview in Collabora" + text: "View in Collabora Online" collabora_edit: id: collabora_edit table: media @@ -168,7 +168,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - text: "Edit in Collabora" + text: "Edit in Collabora Online" pager: type: mini options: diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php index 3c72b5e1..e561270f 100644 --- a/tests/src/Kernel/ViewsLinkFieldsTest.php +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -126,12 +126,12 @@ protected function doTestLinks(array $expected_results, AccountInterface $accoun $info = [ 'preview' => [ - 'label' => 'Preview in Collabora', + 'label' => 'View in Collabora Online', 'field_id' => 'collabora_preview', 'route' => 'collabora-online.view' ], 'edit' => [ - 'label' => 'Edit in Collabora', + 'label' => 'Edit in Collabora Online', 'field_id' => 'collabora_edit', 'route' => 'collabora-online.edit' ], From 02284742a8c25bd8d6a702d99f501cf487ae7fd5 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Wed, 20 Nov 2024 10:00:35 +0100 Subject: [PATCH 18/21] Issue CollaboraOnline/collabora-drupal#52: Index readability. --- tests/src/Kernel/ViewsLinkFieldsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php index e561270f..45cb4dd3 100644 --- a/tests/src/Kernel/ViewsLinkFieldsTest.php +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -137,8 +137,8 @@ protected function doTestLinks(array $expected_results, AccountInterface $accoun ], ]; - $i = 0; // Check each expected results for every media. + $i = 0; foreach (Media::loadMultiple() as $media) { foreach ($expected_results as $operation => $expected_result) { $expected_link = ''; From ccfa8e7998dc8bdc82dbb72c6d11594cb8d64980 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Thu, 21 Nov 2024 08:31:42 +0100 Subject: [PATCH 19/21] Issue CollaboraOnline/collabora-drupal#52: Test and docs. --- .../tests/src/Functional/GroupMediaViewsTest.php | 2 +- tests/src/Kernel/ViewsLinkFieldsTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php index a67c6a3e..a6b5f65b 100644 --- a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php +++ b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php @@ -92,7 +92,7 @@ public function testViewLinks(): void { $this->assertEquals('Bundle', $cols[1]->getText()); $this->assertEquals('Status', $cols[2]->getText()); $this->assertEquals('Publisher', $cols[3]->getText()); - // Support for different vesrions of groupmedia. + // Support different versions of groupmedia. $this->assertTrue(in_array($cols[4]->getText(), ['Operations', 'Dropbutton'])); // Check that rows contain new links for operations in Collabora. diff --git a/tests/src/Kernel/ViewsLinkFieldsTest.php b/tests/src/Kernel/ViewsLinkFieldsTest.php index 45cb4dd3..2aa9e7ef 100644 --- a/tests/src/Kernel/ViewsLinkFieldsTest.php +++ b/tests/src/Kernel/ViewsLinkFieldsTest.php @@ -62,7 +62,6 @@ protected function setUp(): void { // Create two medias to check access with different scopes, 'any' and 'own'. $this->createMediaEntity('document'); $this->ownMedia = $this->createMediaEntity('document'); - ; } /** From a3ca7a945bfa79b1e79e653b8460744c3783a165 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Wed, 20 Nov 2024 17:33:55 +0100 Subject: [PATCH 20/21] Issue CollaboraOnline/collabora-drupal#52: Harcoded entity labels. --- .../tests/src/Functional/GroupMediaViewsTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php index a6b5f65b..b574ba74 100644 --- a/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php +++ b/modules/collabora_online_group/tests/src/Functional/GroupMediaViewsTest.php @@ -43,7 +43,10 @@ class GroupMediaViewsTest extends BrowserTestBase { public function testViewLinks(): void { // Add configuration needed for testing. $group_type = $this->createGroupType(['id' => 'group_type_1']); - $media_type = $this->createMediaType('file', ['id' => 'document']); + $this->createMediaType('file', [ + 'id' => 'document', + 'label' => 'Document', + ]); $this->createGroupRole([ 'group_type' => 'group_type_1', 'scope' => PermissionScopeInterface::INSIDER_ID, @@ -64,7 +67,7 @@ public function testViewLinks(): void { // Create content. $group = $this->createGroup(['type' => 'group_type_1']); - for ($i = 1; $i < 4; $i++) { + for ($i = 0; $i < 3; $i++) { $media = $this->createMediaEntity('document', [ 'id' => 'media_' . $i, 'name' => 'Media ' . $i, @@ -101,8 +104,8 @@ public function testViewLinks(): void { $i = 0; foreach (Media::loadMultiple() as $media) { $cols = $rows[$i]->findAll('css', 'td'); - $this->assertEquals($media->getName(), $cols[0]->getText()); - $this->assertEquals($media_type->label(), $cols[1]->getText()); + $this->assertEquals('Media ' . $i, $cols[0]->getText()); + $this->assertEquals('Document', $cols[1]->getText()); $this->assertEquals('Yes', $cols[2]->getText()); $this->assertEquals('Anonymous', $cols[3]->getText()); $operation_links = $cols[4]->findAll('css', 'a'); From 4dc65546f9a7dd4cce796eb50205c3437709a317 Mon Sep 17 00:00:00 2001 From: AaronGilMartinez Date: Thu, 21 Nov 2024 08:47:54 +0100 Subject: [PATCH 21/21] Issue CollaboraOnline/collabora-drupal#52: Add default label. --- src/Plugin/views/field/CollaboraEdit.php | 29 ++++++++++++------- src/Plugin/views/field/CollaboraPreview.php | 29 ++++++++++++------- .../views.view.test_collabora_links.yml | 4 +-- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/Plugin/views/field/CollaboraEdit.php b/src/Plugin/views/field/CollaboraEdit.php index 56bedf4c..92bc2bd7 100644 --- a/src/Plugin/views/field/CollaboraEdit.php +++ b/src/Plugin/views/field/CollaboraEdit.php @@ -5,6 +5,7 @@ namespace Drupal\collabora_online\Plugin\views\field; use Drupal\collabora_online\Cool\CoolUtils; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\views\Attribute\ViewsField; use Drupal\views\Plugin\views\field\LinkBase; @@ -18,18 +19,24 @@ #[ViewsField('media_collabora_edit')] class CollaboraEdit extends LinkBase { - /** - * {@inheritdoc} - */ - protected function getUrlInfo(ResultRow $row): Url|null { - /** @var \Drupal\media\MediaInterface $entity */ - $entity = $this->getEntity($row); + /** + * {@inheritdoc} + */ + protected function getUrlInfo(ResultRow $row): Url|null { + /** @var \Drupal\media\MediaInterface $entity */ + $entity = $this->getEntity($row); - if ($entity === NULL) { - return NULL; - } + if ($entity === NULL) { + return NULL; + } - return CoolUtils::getEditorUrl($entity, TRUE); - } + return CoolUtils::getEditorUrl($entity, TRUE); + } + /** + * {@inheritdoc} + */ + protected function getDefaultLabel(): TranslatableMarkup { + return $this->t('Edit in Collabora Online'); + } } diff --git a/src/Plugin/views/field/CollaboraPreview.php b/src/Plugin/views/field/CollaboraPreview.php index a0d24411..e93817f9 100644 --- a/src/Plugin/views/field/CollaboraPreview.php +++ b/src/Plugin/views/field/CollaboraPreview.php @@ -5,6 +5,7 @@ namespace Drupal\collabora_online\Plugin\views\field; use Drupal\collabora_online\Cool\CoolUtils; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\views\Attribute\ViewsField; use Drupal\views\Plugin\views\field\LinkBase; @@ -18,18 +19,24 @@ #[ViewsField('media_collabora_preview')] class CollaboraPreview extends LinkBase { - /** - * {@inheritdoc} - */ - protected function getUrlInfo(ResultRow $row): Url|null { - /** @var \Drupal\media\MediaInterface $entity */ - $entity = $this->getEntity($row); + /** + * {@inheritdoc} + */ + protected function getUrlInfo(ResultRow $row): Url|null { + /** @var \Drupal\media\MediaInterface $entity */ + $entity = $this->getEntity($row); - if ($entity === NULL) { - return NULL; - } + if ($entity === NULL) { + return NULL; + } - return CoolUtils::getEditorUrl($entity, FALSE); - } + return CoolUtils::getEditorUrl($entity, FALSE); + } + /** + * {@inheritdoc} + */ + protected function getDefaultLabel(): TranslatableMarkup { + return $this->t('View in Collabora Online'); + } } diff --git a/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml index 58fd87ac..7f79189b 100644 --- a/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml +++ b/tests/modules/collabora_online_test/config/optional/views.view.test_collabora_links.yml @@ -117,7 +117,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - text: "View in Collabora Online" + text: "" collabora_edit: id: collabora_edit table: media @@ -168,7 +168,7 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - text: "Edit in Collabora Online" + text: "" pager: type: mini options: