From 3839ceec793d9472a0a4ccf2d3dbea2f9d78c736 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Wed, 26 Jun 2024 16:20:10 +0100 Subject: [PATCH 01/20] Issue-85; Adding View for content by owner under /admin/content/localgov-content-by-owner plus tab and link --- .../views.view.localgov_content_by_owner.yml | 633 ++++++++++++++++++ ...gov_workflows_notifications.links.menu.yml | 6 + ...gov_workflows_notifications.links.task.yml | 5 + 3 files changed, 644 insertions(+) create mode 100644 modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml diff --git a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml new file mode 100644 index 0000000..50c3b48 --- /dev/null +++ b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml @@ -0,0 +1,633 @@ +langcode: en +status: true +dependencies: + module: + - localgov_workflows_notifications + - node + - user +id: localgov_content_by_owner +label: 'Content by owner' +module: views +description: '' +tag: '' +base_table: node_field_data +base_field: nid +display: + default: + id: default + display_title: Default + display_plugin: default + position: 0 + display_options: + title: 'Content by owner' + fields: + user: + id: user + table: localgov_service_contact + field: user + relationship: localgov_service_contacts_target_id + group_type: group + admin_label: '' + entity_type: localgov_service_contact + entity_field: user + plugin_id: field + label: 'Service contact' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + title: + id: title + table: node_field_data + field: title + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: title + plugin_id: field + label: Title + 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 + type: + id: type + table: node_field_data + field: type + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: type + plugin_id: field + label: 'Content type' + 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 + name: + id: name + table: users_field_data + field: name + relationship: uid + group_type: group + admin_label: '' + entity_type: user + entity_field: name + plugin_id: field + label: Author + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 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: user_name + 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 + status: + id: status + table: node_field_data + field: status + relationship: none + group_type: group + admin_label: '' + entity_type: node + 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: custom + format_custom_false: Unpublished + format_custom_true: Published + 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 + changed: + id: changed + table: node_field_data + field: changed + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: changed + plugin_id: field + label: Updated + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: timestamp + settings: + date_format: short + custom_date_format: '' + timezone: '' + tooltip: + date_format: long + custom_date_format: '' + time_diff: + enabled: false + future_format: '@interval hence' + past_format: '@interval ago' + granularity: 2 + refresh: 60 + description: '' + 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 + operations: + id: operations + table: node + field: operations + relationship: none + group_type: group + admin_label: '' + entity_type: node + plugin_id: entity_operations + 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 + 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: perm + options: + perm: 'access content' + cache: + type: tag + options: { } + empty: { } + sorts: { } + arguments: { } + filters: { } + filter_groups: + operator: AND + groups: { } + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + columns: + user: user + title: title + type: type + name: name + status: status + changed: changed + operations: operations + default: changed + info: + user: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + title: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + type: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + name: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + status: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + changed: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: priority-low + operations: + align: '' + separator: '' + empty_column: false + responsive: '' + override: true + sticky: true + summary: '' + empty_table: true + caption: '' + description: '' + row: + type: fields + query: + type: views_query + options: + query_comment: '' + disable_sql_rewrite: false + distinct: false + replica: false + query_tags: { } + relationships: + uid: + id: uid + table: node_field_data + field: uid + relationship: none + group_type: group + admin_label: author + entity_type: node + entity_field: uid + plugin_id: standard + required: true + localgov_service_contacts_target_id: + id: localgov_service_contacts_target_id + table: node__localgov_service_contacts + field: localgov_service_contacts_target_id + relationship: none + group_type: group + admin_label: 'Service contact' + entity_type: node + entity_field: localgov_service_contacts + plugin_id: standard + required: true + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } + page_1: + id: page_1 + display_title: Page + display_plugin: page + position: 1 + display_options: + display_extenders: { } + path: admin/content/localgov-content-by-owner + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml index abe311b..b35b4ba 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml @@ -4,6 +4,12 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection parent: system.admin_content +localgov_workflows_notifications.content_by_owner: + title: 'Content by owner' + description: 'Table of contents, by owner.' + route_name: view.localgov_content_by_owner.page_1 + parent: system.admin_content + localgov_workflows_notifications.settings: title: 'LocalGov workflow notifications' description: 'Administer LocalGov workflow notifications' diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml index 053eb59..613c2eb 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml @@ -16,3 +16,8 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection base_route: system.admin_content weight: 10 +localgov_workflows_notifications.content_by_owner: + title: 'Content by owner' + route_name: view.localgov_content_by_owner.page_1 + base_route: system.admin_content + weight: 11 From a47cc70fcfb768732aeae3745493985fb740084b Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Wed, 26 Jun 2024 17:47:17 +0100 Subject: [PATCH 02/20] Issue-85; Removing task & tab as View might not be enabled on all sites --- .../localgov_workflows_notifications.links.menu.yml | 6 ------ .../localgov_workflows_notifications.links.task.yml | 5 ----- 2 files changed, 11 deletions(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml index b35b4ba..abe311b 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml @@ -4,12 +4,6 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection parent: system.admin_content -localgov_workflows_notifications.content_by_owner: - title: 'Content by owner' - description: 'Table of contents, by owner.' - route_name: view.localgov_content_by_owner.page_1 - parent: system.admin_content - localgov_workflows_notifications.settings: title: 'LocalGov workflow notifications' description: 'Administer LocalGov workflow notifications' diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml index 613c2eb..053eb59 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml @@ -16,8 +16,3 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection base_route: system.admin_content weight: 10 -localgov_workflows_notifications.content_by_owner: - title: 'Content by owner' - route_name: view.localgov_content_by_owner.page_1 - base_route: system.admin_content - weight: 11 From 3fc09447847e99e4eaa05f6e0bd9b5ec75fb85dd Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Fri, 28 Jun 2024 17:47:20 +0100 Subject: [PATCH 03/20] Issue-85; Making local task dynamic to avoid fatal error if the View is not present --- ...gov_workflows_notifications.links.task.yml | 3 ++ ...calgovWorkflowsNotificationsLocalTasks.php | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml index 053eb59..f3bb640 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml @@ -16,3 +16,6 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection base_route: system.admin_content weight: 10 +localgov_workflows_notifications.content_by_owner: + deriver: 'Drupal\localgov_workflows_notifications\Plugin\Derivative\LocalgovWorkflowsNotificationsLocalTasks' + weight: 11 diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php new file mode 100644 index 0000000..69787dc --- /dev/null +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php @@ -0,0 +1,43 @@ +derivatives = []; + + // Only create the local task if the corresponding View is present. + $view = Views::getView('localgov_content_by_owner'); + if ($view instanceof ViewExecutable) { + $this->derivatives['localgov_workflows_notifications.content_by_owner'] = $base_plugin_definition; + $this->derivatives['localgov_workflows_notifications.content_by_owner']['route_name'] = 'view.localgov_content_by_owner.page_1'; + $this->derivatives['localgov_workflows_notifications.content_by_owner']['base_route'] = 'system.admin_content'; + $this->derivatives['localgov_workflows_notifications.content_by_owner']['title'] = $this->t('Content by owner'); + } + return $this->derivatives; + } + +} From c02e2dd49520a6b0e6fae49f106663d6f8805c7c Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Fri, 28 Jun 2024 18:18:57 +0100 Subject: [PATCH 04/20] Issue-85; Adding dynamic menu link to avoid fatal error if the View is not present --- ...gov_workflows_notifications.links.menu.yml | 4 ++ ...ovWorkflowsNotificationsContentByOwner.php | 64 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml index abe311b..0f3211b 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.menu.yml @@ -10,3 +10,7 @@ localgov_workflows_notifications.settings: parent: system.admin_config_workflow route_name: localgov_workflows_notifications.settings weight: 10 + +localgov_workflows_notifications.content_by_owner: + deriver: 'Drupal\localgov_workflows_notifications\Plugin\Derivative\LocalgovWorkflowsNotificationsContentByOwner' + weight: 11 diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php new file mode 100644 index 0000000..d8fea90 --- /dev/null +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php @@ -0,0 +1,64 @@ +entityTypeManager = $entity_type_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, $base_plugin_id) { + return new static( + $base_plugin_id, + $container->get('entity_type.manager') + ); + } + + /** + * {@inheritdoc} + */ + public function getDerivativeDefinitions($base_plugin_definition) { + $links = []; + + // Only create the menu link if the corresponding View is present. + $view = Views::getView('localgov_content_by_owner'); + if ($view instanceof ViewExecutable) { + $links['localgov_workflows_notifications_content_by_owner'] = [ + 'title' => $this->t('Content by owner'), + 'description' => $this->t('Table of contents, by owner.'), + 'route_name' => 'view.localgov_content_by_owner.page_1', + 'parent' => 'system.admin_content', + ] + $base_plugin_definition; + } + + return $links; + } + +} From f1ff52a5cdb1844417610f642bf06171367ed744 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Fri, 28 Jun 2024 18:32:27 +0100 Subject: [PATCH 05/20] Issue-85; Removing Operations from new View --- .../views.view.localgov_content_by_owner.yml | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml index 50c3b48..c20cd03 100644 --- a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml +++ b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml @@ -407,57 +407,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - operations: - id: operations - table: node - field: operations - relationship: none - group_type: group - admin_label: '' - entity_type: node - plugin_id: entity_operations - 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 pager: type: mini options: From 1bc3efcd92b6004126cef6095dce764f1c6b7f17 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Tue, 30 Jul 2024 16:38:13 +0300 Subject: [PATCH 06/20] 85; Fixing CS indentation --- .../LocalgovWorkflowsNotificationsContentByOwner.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php index d8fea90..e248d18 100644 --- a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php @@ -51,11 +51,11 @@ public function getDerivativeDefinitions($base_plugin_definition) { $view = Views::getView('localgov_content_by_owner'); if ($view instanceof ViewExecutable) { $links['localgov_workflows_notifications_content_by_owner'] = [ - 'title' => $this->t('Content by owner'), - 'description' => $this->t('Table of contents, by owner.'), - 'route_name' => 'view.localgov_content_by_owner.page_1', - 'parent' => 'system.admin_content', - ] + $base_plugin_definition; + 'title' => $this->t('Content by owner'), + 'description' => $this->t('Table of contents, by owner.'), + 'route_name' => 'view.localgov_content_by_owner.page_1', + 'parent' => 'system.admin_content', + ] + $base_plugin_definition; } return $links; From d0ee56ab0ac73988b4f4346a8ee2eec2ca66dfcd Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sat, 24 Aug 2024 17:37:30 +0100 Subject: [PATCH 07/20] 85; Adding property definition --- .../LocalgovWorkflowsNotificationsContentByOwner.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php index e248d18..e147738 100644 --- a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php @@ -17,17 +17,25 @@ class LocalgovWorkflowsNotificationsContentByOwner extends DeriverBase implement use StringTranslationTrait; + /** + * The base plugin ID. + * + * @var string + */ + protected string $basePluginId; + /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** * {@inheritdoc} */ public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager) { + $this->basePluginId = $base_plugin_id; $this->entityTypeManager = $entity_type_manager; } From 768e19093a22bdffe8f1ac62a6dfe2e3c9af13cc Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sat, 24 Aug 2024 17:43:37 +0100 Subject: [PATCH 08/20] 85; CS --- .idea/.gitignore | 8 +++++++ .idea/localgov_workflows.iml | 11 ++++++++++ .idea/modules.xml | 8 +++++++ .idea/php.xml | 22 +++++++++++++++++++ .idea/vcs.xml | 6 +++++ ...ovWorkflowsNotificationsContentByOwner.php | 12 +++++----- 6 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/localgov_workflows.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/localgov_workflows.iml b/.idea/localgov_workflows.iml new file mode 100644 index 0000000..a85ab09 --- /dev/null +++ b/.idea/localgov_workflows.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8207856 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..29059d0 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php index e147738..7d07713 100644 --- a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php @@ -17,12 +17,12 @@ class LocalgovWorkflowsNotificationsContentByOwner extends DeriverBase implement use StringTranslationTrait; - /** - * The base plugin ID. - * - * @var string - */ - protected string $basePluginId; + /** + * The base plugin ID. + * + * @var string + */ + protected string $basePluginId; /** * The entity type manager. From bfc6eee4b3867472531e866b13f50454e25804ec Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sat, 24 Aug 2024 17:44:51 +0100 Subject: [PATCH 09/20] 85; CS --- .idea/.gitignore | 8 -------- .idea/localgov_workflows.iml | 11 ----------- .idea/modules.xml | 8 -------- .idea/php.xml | 22 ---------------------- .idea/vcs.xml | 6 ------ 5 files changed, 55 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/localgov_workflows.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/php.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/localgov_workflows.iml b/.idea/localgov_workflows.iml deleted file mode 100644 index a85ab09..0000000 --- a/.idea/localgov_workflows.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8207856..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index 29059d0..0000000 --- a/.idea/php.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 88ad1ecf99c18486e10725255bb2f052612232a9 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Wed, 4 Sep 2024 15:52:03 +0100 Subject: [PATCH 10/20] 85; Moving custom View from install to optional config folder, also removing time_diff description from View's YML --- .../views.view.localgov_content_by_owner.yml | 1 - 1 file changed, 1 deletion(-) rename modules/localgov_workflows_notifications/config/{install => optional}/views.view.localgov_content_by_owner.yml (99%) diff --git a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml similarity index 99% rename from modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml rename to modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml index c20cd03..9fc9091 100644 --- a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml +++ b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml @@ -396,7 +396,6 @@ display: past_format: '@interval ago' granularity: 2 refresh: 60 - description: '' group_column: value group_columns: { } group_rows: true From 0e26a83df0eca4cfa7681cb6f0de857f4980bcb5 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sun, 27 Oct 2024 20:19:36 +0000 Subject: [PATCH 11/20] 85; Adjusting content by owner View path and Adding menu details to View --- .../views.view.localgov_content_by_owner.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) rename modules/localgov_workflows_notifications/config/{optional => install}/views.view.localgov_content_by_owner.yml (97%) diff --git a/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml similarity index 97% rename from modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml rename to modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml index 9fc9091..eab358d 100644 --- a/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml +++ b/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml @@ -1,6 +1,8 @@ langcode: en status: true dependencies: + config: + - system.menu.admin module: - localgov_workflows_notifications - node @@ -410,6 +412,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 @@ -569,7 +572,16 @@ display: position: 1 display_options: display_extenders: { } - path: admin/content/localgov-content-by-owner + path: admin/content/localgov-service-contact/content-by-owner + menu: + type: normal + title: Content + description: '' + weight: 0 + expanded: false + menu_name: admin + parent: entity.localgov_service_contact.collection + context: '0' cache_metadata: max-age: -1 contexts: From 1aba7b4167e7700117d4cedde6f65f5aa806c4fc Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sun, 27 Oct 2024 21:31:08 +0000 Subject: [PATCH 12/20] 85; Restoring view --- .../views.view.localgov_content_by_owner.yml | 11 ----------- 1 file changed, 11 deletions(-) rename modules/localgov_workflows_notifications/config/{install => optional}/views.view.localgov_content_by_owner.yml (98%) diff --git a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml similarity index 98% rename from modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml rename to modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml index eab358d..8bf8882 100644 --- a/modules/localgov_workflows_notifications/config/install/views.view.localgov_content_by_owner.yml +++ b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml @@ -1,8 +1,6 @@ langcode: en status: true dependencies: - config: - - system.menu.admin module: - localgov_workflows_notifications - node @@ -573,15 +571,6 @@ display: display_options: display_extenders: { } path: admin/content/localgov-service-contact/content-by-owner - menu: - type: normal - title: Content - description: '' - weight: 0 - expanded: false - menu_name: admin - parent: entity.localgov_service_contact.collection - context: '0' cache_metadata: max-age: -1 contexts: From b75c325ec1bd5932dea4ef9353e3afe374bd98ec Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Fri, 1 Nov 2024 17:29:38 +0000 Subject: [PATCH 13/20] 85; Making the local_tasks dynamic and adding proper parent IDs --- ...lgov_workflows_notifications.links.task.yml | 2 +- ...govWorkflowsNotificationsContentByOwner.php | 2 +- ...ocalgovWorkflowsNotificationsLocalTasks.php | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml index f3bb640..43aa38e 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.links.task.yml @@ -16,6 +16,6 @@ entity.localgov_service_contact.collection: route_name: entity.localgov_service_contact.collection base_route: system.admin_content weight: 10 -localgov_workflows_notifications.content_by_owner: +localgov_workflows_notifications.local_tasks: deriver: 'Drupal\localgov_workflows_notifications\Plugin\Derivative\LocalgovWorkflowsNotificationsLocalTasks' weight: 11 diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php index 7d07713..c5b5a95 100644 --- a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsContentByOwner.php @@ -62,7 +62,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { 'title' => $this->t('Content by owner'), 'description' => $this->t('Table of contents, by owner.'), 'route_name' => 'view.localgov_content_by_owner.page_1', - 'parent' => 'system.admin_content', + 'parent' => 'entity.localgov_service_contact.collection', ] + $base_plugin_definition; } diff --git a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php index 69787dc..2d1200e 100644 --- a/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php +++ b/modules/localgov_workflows_notifications/src/Plugin/Derivative/LocalgovWorkflowsNotificationsLocalTasks.php @@ -28,16 +28,22 @@ public static function create(ContainerInterface $container, $base_plugin_id) { */ public function getDerivativeDefinitions($base_plugin_definition): array { $this->derivatives = []; - // Only create the local task if the corresponding View is present. $view = Views::getView('localgov_content_by_owner'); if ($view instanceof ViewExecutable) { - $this->derivatives['localgov_workflows_notifications.content_by_owner'] = $base_plugin_definition; - $this->derivatives['localgov_workflows_notifications.content_by_owner']['route_name'] = 'view.localgov_content_by_owner.page_1'; - $this->derivatives['localgov_workflows_notifications.content_by_owner']['base_route'] = 'system.admin_content'; - $this->derivatives['localgov_workflows_notifications.content_by_owner']['title'] = $this->t('Content by owner'); + $this->derivatives['localgov_workflows_notifications.contacts'] = $base_plugin_definition; + $this->derivatives['localgov_workflows_notifications.contacts']['route_name'] = 'entity.localgov_service_contact.collection'; + $this->derivatives['localgov_workflows_notifications.contacts']['base_route'] = 'entity.localgov_service_contact.collection'; + $this->derivatives['localgov_workflows_notifications.contacts']['parent_id'] = 'entity.localgov_service_contact.collection'; + $this->derivatives['localgov_workflows_notifications.contacts']['title'] = $this->t('Contacts'); + + $this->derivatives['localgov_workflows_notifications.content'] = $base_plugin_definition; + $this->derivatives['localgov_workflows_notifications.content']['route_name'] = 'view.localgov_content_by_owner.page_1'; + $this->derivatives['localgov_workflows_notifications.content']['parent_id'] = 'entity.localgov_service_contact.collection'; + $this->derivatives['localgov_workflows_notifications.content']['base_route'] = 'entity.localgov_service_contact.collection'; + $this->derivatives['localgov_workflows_notifications.content']['title'] = $this->t('Content'); } - return $this->derivatives; + return parent::getDerivativeDefinitions($base_plugin_definition); } } From 4327597e7ef8c3eab0fd759abb3a1395c14f6cdc Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sun, 3 Nov 2024 19:04:10 +0000 Subject: [PATCH 14/20] 85; Adding contextual filter to content by owner View AND adding new operation link to service contact entity collection linking to filtered content by owner View based on the View's contextual filter --- .../views.view.localgov_content_by_owner.yml | 137 ++++++++++++------ .../localgov_workflows_notifications.module | 26 ++++ 2 files changed, 115 insertions(+), 48 deletions(-) diff --git a/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml index 8bf8882..0f1e3a8 100644 --- a/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml +++ b/modules/localgov_workflows_notifications/config/optional/views.view.localgov_content_by_owner.yml @@ -21,44 +21,26 @@ display: display_options: title: 'Content by owner' fields: - user: - id: user - table: localgov_service_contact - field: user - relationship: localgov_service_contacts_target_id + title: + id: title + table: node_field_data + field: title + relationship: none group_type: group admin_label: '' - entity_type: localgov_service_contact - entity_field: user + entity_type: node + entity_field: title plugin_id: field - label: 'Service contact' + label: Title 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: '' + word_boundary: false + ellipsis: false strip_tags: false trim: false - preserve_tags: '' html: false element_type: '' element_class: '' @@ -72,11 +54,11 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label + click_sort_column: value + type: string settings: - link: true - group_column: target_id + link_to_entity: true + group_column: value group_columns: { } group_rows: true delta_limit: 0 @@ -86,26 +68,44 @@ display: multi_type: separator separator: ', ' field_api_classes: false - title: - id: title - table: node_field_data - field: title - relationship: none + user: + id: user + table: localgov_service_contact + field: user + relationship: localgov_service_contacts_target_id group_type: group admin_label: '' - entity_type: node - entity_field: title + entity_type: localgov_service_contact + entity_field: user plugin_id: field - label: Title + label: 'Service contact' exclude: false alter: alter_text: false + text: '' make_link: false + path: '' absolute: false - word_boundary: false - ellipsis: 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: '' @@ -119,11 +119,11 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - click_sort_column: value - type: string + click_sort_column: target_id + type: entity_reference_label settings: - link_to_entity: true - group_column: value + link: true + group_column: target_id group_columns: { } group_rows: true delta_limit: 0 @@ -444,7 +444,45 @@ display: options: { } empty: { } sorts: { } - arguments: { } + arguments: + id: + id: id + table: localgov_service_contact + field: id + relationship: localgov_service_contacts_target_id + group_type: group + admin_label: '' + entity_type: localgov_service_contact + entity_field: id + plugin_id: numeric + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: query_parameter + default_argument_options: + query_param: service-contact-id + fallback: all + multiple: or + 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: true + validate: + type: none + fail: empty + validate_options: { } + break_phrase: false + not: false filters: { } filter_groups: operator: AND @@ -559,16 +597,18 @@ display: contexts: - 'languages:language_content' - 'languages:language_interface' + - url - url.query_args - 'user.node_grants:view' - user.permissions tags: { } page_1: id: page_1 - display_title: Page + display_title: 'Content by owner View' display_plugin: page position: 1 display_options: + display_description: 'Displays a list of content by service contact' display_extenders: { } path: admin/content/localgov-service-contact/content-by-owner cache_metadata: @@ -576,6 +616,7 @@ display: contexts: - 'languages:language_content' - 'languages:language_interface' + - url - url.query_args - 'user.node_grants:view' - user.permissions diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module index 3468bb2..c925a74 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module @@ -5,11 +5,15 @@ * Primary module hooks for LocalGov Review Notifications module. */ +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Url; use Drupal\localgov_roles\RolesHelper; +use Drupal\views\ViewExecutable; +use Drupal\views\Views; /** * Implements hook_entity_base_field_info(). @@ -182,3 +186,25 @@ function localgov_workflows_notifications_localgov_roles_default(): array { ], ]; } + +/** + * Implements hook_entity_operation_alter(). + */ +function localgov_workflows_notifications_entity_operation_alter(array &$operations, EntityInterface $entity) { + // Add "View content" operation link for every service contact listed. + // First make sure that the "Content by owner" View is enabled. + $view = Views::getView('localgov_content_by_owner'); + if ($view instanceof ViewExecutable) { + // Only add the operation link to the Service contact entity collection. + if ($entity->bundle() === 'localgov_service_contact') { + $operations['service_contact_view_content'] = [ + 'title' => t('View content'), + // Point to a filtered version of the "Content by owner" View, using the View's contextual filter. + 'url' => Url::fromRoute('view.localgov_content_by_owner.page_1', [ + ['service-contact-id' => $entity->id()], + ]), + 'weight' => 150, + ]; + } + } +} From eaafa49625a85c4c86cdfa386fb5728df031d90c Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sun, 3 Nov 2024 19:09:26 +0000 Subject: [PATCH 15/20] 85; Adding contextual filter to content by owner View AND adding new operation link to service contact entity collection linking to filtered content by owner View based on the View's contextual filter --- .../localgov_workflows_notifications.module | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module index c925a74..978e4c7 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module @@ -197,14 +197,15 @@ function localgov_workflows_notifications_entity_operation_alter(array &$operati if ($view instanceof ViewExecutable) { // Only add the operation link to the Service contact entity collection. if ($entity->bundle() === 'localgov_service_contact') { - $operations['service_contact_view_content'] = [ - 'title' => t('View content'), - // Point to a filtered version of the "Content by owner" View, using the View's contextual filter. - 'url' => Url::fromRoute('view.localgov_content_by_owner.page_1', [ - ['service-contact-id' => $entity->id()], - ]), - 'weight' => 150, - ]; + $operations['service_contact_view_content'] = [ + 'title' => t('View content'), + // Point to a filtered version of the "Content by owner" View, + //using the View's contextual filter. + 'url' => Url::fromRoute('view.localgov_content_by_owner.page_1', [ + ['service-contact-id' => $entity->id()], + ]), + 'weight' => 150, + ]; } } } From dccb548ac5cef07692eadad3b09025bb880ffa5c Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Sun, 3 Nov 2024 19:21:34 +0000 Subject: [PATCH 16/20] 85; CS --- .../localgov_workflows_notifications.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module index 978e4c7..65e93ee 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.module +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.module @@ -200,7 +200,7 @@ function localgov_workflows_notifications_entity_operation_alter(array &$operati $operations['service_contact_view_content'] = [ 'title' => t('View content'), // Point to a filtered version of the "Content by owner" View, - //using the View's contextual filter. + // using the View's contextual filter. 'url' => Url::fromRoute('view.localgov_content_by_owner.page_1', [ ['service-contact-id' => $entity->id()], ]), From 5d897580e846bb97c8dde01cecf6e30a41afeb99 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Tue, 5 Nov 2024 12:55:54 +0000 Subject: [PATCH 17/20] 85; Adding update hook to import optional configuration --- .../localgov_workflows_notifications.install | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install index 8921a8d..e86592e 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install @@ -5,6 +5,10 @@ * Install functions for the LocalGov Review Notifications module. */ +use Drupal\Core\Config\ConfigInstallerInterface; +use Drupal\Core\Config\FileStorage; +use Drupal\Core\Config\StorageInterface; + /** * Implements hook_install(). */ @@ -40,3 +44,20 @@ function localgov_workflows_notifications_update_10001(&$sandbox) { $timer->update(); } } + +/** + * Enable Content By Owner View. + */ +function localgov_workflows_notifications_update_10002(&$sandbox) { + /** @var ConfigInstallerInterface $config_installer */ + $config_installer = \Drupal::service('config.installer'); + $config_installer->installDefaultConfig('module', 'search_api_solr'); + $optional_install_path = \Drupal::moduleHandler() + ->getModule('search_api_solr') + ->getPath() . '/config/optional'; + if (is_dir($optional_install_path)) { + // Install the module's optional configuration that's not installed yet. + $storage = new FileStorage($optional_install_path, StorageInterface::DEFAULT_COLLECTION); + $config_installer->installOptionalConfig($storage); + } +} From 4594ec5b47329254de1d792e6373cab0d3793c07 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Tue, 5 Nov 2024 12:57:46 +0000 Subject: [PATCH 18/20] 85; Adding update hook to import optional configuration --- .../localgov_workflows_notifications.install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install index e86592e..39241f0 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install @@ -51,9 +51,9 @@ function localgov_workflows_notifications_update_10001(&$sandbox) { function localgov_workflows_notifications_update_10002(&$sandbox) { /** @var ConfigInstallerInterface $config_installer */ $config_installer = \Drupal::service('config.installer'); - $config_installer->installDefaultConfig('module', 'search_api_solr'); + $config_installer->installDefaultConfig('module', 'localgov_workflows_notifications'); $optional_install_path = \Drupal::moduleHandler() - ->getModule('search_api_solr') + ->getModule('localgov_workflows_notifications') ->getPath() . '/config/optional'; if (is_dir($optional_install_path)) { // Install the module's optional configuration that's not installed yet. From 69b34513803cc8f49f3d079a274677fdebb6f07f Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Tue, 5 Nov 2024 13:13:18 +0000 Subject: [PATCH 19/20] 85; CS --- .../localgov_workflows_notifications.install | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install index 39241f0..4664390 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install @@ -5,7 +5,6 @@ * Install functions for the LocalGov Review Notifications module. */ -use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\StorageInterface; @@ -49,12 +48,12 @@ function localgov_workflows_notifications_update_10001(&$sandbox) { * Enable Content By Owner View. */ function localgov_workflows_notifications_update_10002(&$sandbox) { - /** @var ConfigInstallerInterface $config_installer */ + /** @var \Drupal\Core\Config\ConfigInstallerInterface $config_installer */ $config_installer = \Drupal::service('config.installer'); $config_installer->installDefaultConfig('module', 'localgov_workflows_notifications'); $optional_install_path = \Drupal::moduleHandler() - ->getModule('localgov_workflows_notifications') - ->getPath() . '/config/optional'; + >getModule('localgov_workflows_notifications') + ->getPath() . '/config/optional'; if (is_dir($optional_install_path)) { // Install the module's optional configuration that's not installed yet. $storage = new FileStorage($optional_install_path, StorageInterface::DEFAULT_COLLECTION); From 4af7ec47ca41cf8e07d01b0e135693e3901e45f5 Mon Sep 17 00:00:00 2001 From: Marios Ioannidis Date: Tue, 5 Nov 2024 13:28:33 +0000 Subject: [PATCH 20/20] 85; CS --- .../localgov_workflows_notifications.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install index 4664390..acbb12d 100644 --- a/modules/localgov_workflows_notifications/localgov_workflows_notifications.install +++ b/modules/localgov_workflows_notifications/localgov_workflows_notifications.install @@ -52,7 +52,7 @@ function localgov_workflows_notifications_update_10002(&$sandbox) { $config_installer = \Drupal::service('config.installer'); $config_installer->installDefaultConfig('module', 'localgov_workflows_notifications'); $optional_install_path = \Drupal::moduleHandler() - >getModule('localgov_workflows_notifications') + ->getModule('localgov_workflows_notifications') ->getPath() . '/config/optional'; if (is_dir($optional_install_path)) { // Install the module's optional configuration that's not installed yet.