From d4e89918048ac7a1257f1b56adaa8059460d7cee Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 27 Nov 2021 15:19:16 +0000 Subject: [PATCH 1/4] replaced deprecated functions --- .../opencase_cases/src/Form/OCCaseRevisionDeleteForm.php | 2 +- .../opencase_cases/src/Form/OCCaseRevisionRevertForm.php | 2 +- modules/opencase_cases/src/Form/OCCaseTypeDeleteForm.php | 2 +- modules/opencase_cases/src/Form/OCCaseTypeForm.php | 4 ++-- modules/opencase_entities/src/Form/OCActivityForm.php | 6 +++--- .../src/Form/OCActivityRevisionDeleteForm.php | 2 +- .../src/Form/OCActivityRevisionRevertForm.php | 2 +- .../opencase_entities/src/Form/OCActivityTypeDeleteForm.php | 2 +- modules/opencase_entities/src/Form/OCActivityTypeForm.php | 4 ++-- modules/opencase_entities/src/Form/OCActorForm.php | 6 +++--- .../src/Form/OCActorRevisionDeleteForm.php | 2 +- .../src/Form/OCActorRevisionRevertForm.php | 2 +- .../opencase_entities/src/Form/OCActorTypeDeleteForm.php | 2 +- modules/opencase_entities/src/Form/OCActorTypeForm.php | 4 ++-- modules/opencase_entities/src/Form/OCEventForm.php | 2 +- modules/opencase_entities/src/Form/OCOrganisationForm.php | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php b/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php index b4a6039..72f90b4 100644 --- a/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php +++ b/modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php @@ -107,7 +107,7 @@ class OCCaseRevisionDeleteForm extends ConfirmFormBase { $this->OCCaseStorage->deleteRevision($this->revision->getRevisionId()); $this->logger('content')->notice('Case: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Case %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + \Drupal::messenger()->addMessage(t('Revision from %revision-date of Case %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); $form_state->setRedirect( 'entity.oc_case.canonical', ['oc_case' => $this->revision->id()] diff --git a/modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php b/modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php index 80d158f..f36b44f 100644 --- a/modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php +++ b/modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php @@ -120,7 +120,7 @@ class OCCaseRevisionRevertForm extends ConfirmFormBase { $this->revision->save(); $this->logger('content')->notice('Case: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Case %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + \Drupal::messenger()->addMessage(t('Case %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); $form_state->setRedirect( 'entity.oc_case.version_history', ['oc_case' => $this->revision->id()] diff --git a/modules/opencase_cases/src/Form/OCCaseTypeDeleteForm.php b/modules/opencase_cases/src/Form/OCCaseTypeDeleteForm.php index f229674..7b407cf 100644 --- a/modules/opencase_cases/src/Form/OCCaseTypeDeleteForm.php +++ b/modules/opencase_cases/src/Form/OCCaseTypeDeleteForm.php @@ -38,7 +38,7 @@ class OCCaseTypeDeleteForm extends EntityConfirmFormBase { public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - drupal_set_message( + \Drupal::messenger()->addMessage( $this->t('content @type: deleted @label.', [ '@type' => $this->entity->bundle(), diff --git a/modules/opencase_cases/src/Form/OCCaseTypeForm.php b/modules/opencase_cases/src/Form/OCCaseTypeForm.php index 2c42f1b..e0d7cdf 100644 --- a/modules/opencase_cases/src/Form/OCCaseTypeForm.php +++ b/modules/opencase_cases/src/Form/OCCaseTypeForm.php @@ -49,13 +49,13 @@ class OCCaseTypeForm extends EntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Case type.', [ + \Drupal::messenger()->addMessage($this->t('Created the %label Case type.', [ '%label' => $oc_case_type->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Case type.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %label Case type.', [ '%label' => $oc_case_type->label(), ])); } diff --git a/modules/opencase_entities/src/Form/OCActivityForm.php b/modules/opencase_entities/src/Form/OCActivityForm.php index b6fa492..54cdd28 100644 --- a/modules/opencase_entities/src/Form/OCActivityForm.php +++ b/modules/opencase_entities/src/Form/OCActivityForm.php @@ -55,19 +55,19 @@ class OCActivityForm extends ContentEntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %bundle.', [ + \Drupal::messenger()->addMessage($this->t('Created the %bundle.', [ '%bundle' => $entity->bundle(), ])); break; default: - drupal_set_message($this->t('Saved the %bundle.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %bundle.', [ '%bundle' => $entity->bundle(), ])); } // If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied". if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished activity entities')) { - drupal_set_message($this->t('The %bundle is now unpublished & hidden from you.', [ + \Drupal::messenger()->addMessage($this->t('The %bundle is now unpublished & hidden from you.', [ '%bundle' => $entity->bundle(), ])); $form_state->setRedirect(''); diff --git a/modules/opencase_entities/src/Form/OCActivityRevisionDeleteForm.php b/modules/opencase_entities/src/Form/OCActivityRevisionDeleteForm.php index adc276f..c129d3f 100644 --- a/modules/opencase_entities/src/Form/OCActivityRevisionDeleteForm.php +++ b/modules/opencase_entities/src/Form/OCActivityRevisionDeleteForm.php @@ -107,7 +107,7 @@ class OCActivityRevisionDeleteForm extends ConfirmFormBase { $this->OCActivityStorage->deleteRevision($this->revision->getRevisionId()); $this->logger('content')->notice('Activity: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Activity %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + \Drupal::messenger()->addMessage(t('Revision from %revision-date of Activity %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); $form_state->setRedirect( 'entity.oc_activity.canonical', ['oc_activity' => $this->revision->id()] diff --git a/modules/opencase_entities/src/Form/OCActivityRevisionRevertForm.php b/modules/opencase_entities/src/Form/OCActivityRevisionRevertForm.php index 5fc3c8b..4421559 100644 --- a/modules/opencase_entities/src/Form/OCActivityRevisionRevertForm.php +++ b/modules/opencase_entities/src/Form/OCActivityRevisionRevertForm.php @@ -120,7 +120,7 @@ class OCActivityRevisionRevertForm extends ConfirmFormBase { $this->revision->save(); $this->logger('content')->notice('Activity: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Activity %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + \Drupal::messenger()->addMessage(t('Activity %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); $form_state->setRedirect( 'entity.oc_activity.version_history', ['oc_activity' => $this->revision->id()] diff --git a/modules/opencase_entities/src/Form/OCActivityTypeDeleteForm.php b/modules/opencase_entities/src/Form/OCActivityTypeDeleteForm.php index fd6bf1f..08479d6 100644 --- a/modules/opencase_entities/src/Form/OCActivityTypeDeleteForm.php +++ b/modules/opencase_entities/src/Form/OCActivityTypeDeleteForm.php @@ -38,7 +38,7 @@ class OCActivityTypeDeleteForm extends EntityConfirmFormBase { public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - drupal_set_message( + \Drupal::messenger()->addMessage( $this->t('content @type: deleted @label.', [ '@type' => $this->entity->bundle(), diff --git a/modules/opencase_entities/src/Form/OCActivityTypeForm.php b/modules/opencase_entities/src/Form/OCActivityTypeForm.php index 845106b..21d2c37 100644 --- a/modules/opencase_entities/src/Form/OCActivityTypeForm.php +++ b/modules/opencase_entities/src/Form/OCActivityTypeForm.php @@ -49,13 +49,13 @@ class OCActivityTypeForm extends EntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Activity type.', [ + \Drupal::messenger()->addMessage($this->t('Created the %label Activity type.', [ '%label' => $oc_activity_type->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Activity type.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %label Activity type.', [ '%label' => $oc_activity_type->label(), ])); } diff --git a/modules/opencase_entities/src/Form/OCActorForm.php b/modules/opencase_entities/src/Form/OCActorForm.php index fe23b62..569fe95 100644 --- a/modules/opencase_entities/src/Form/OCActorForm.php +++ b/modules/opencase_entities/src/Form/OCActorForm.php @@ -48,19 +48,19 @@ class OCActorForm extends ContentEntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created %label.', [ + \Drupal::messenger()->addMessage($this->t('Created %label.', [ '%label' => $entity->label(), ])); break; default: - drupal_set_message($this->t('Saved %label.', [ + \Drupal::messenger()->addMessage($this->t('Saved %label.', [ '%label' => $entity->label(), ])); } // If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied". if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished actor entities')) { - drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [ + \Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [ '%label' => $entity->label(), ])); $form_state->setRedirect(''); diff --git a/modules/opencase_entities/src/Form/OCActorRevisionDeleteForm.php b/modules/opencase_entities/src/Form/OCActorRevisionDeleteForm.php index a4c686b..9650952 100644 --- a/modules/opencase_entities/src/Form/OCActorRevisionDeleteForm.php +++ b/modules/opencase_entities/src/Form/OCActorRevisionDeleteForm.php @@ -107,7 +107,7 @@ class OCActorRevisionDeleteForm extends ConfirmFormBase { $this->OCActorStorage->deleteRevision($this->revision->getRevisionId()); $this->logger('content')->notice('Actor: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Actor %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + \Drupal::messenger()->addMessage(t('Revision from %revision-date of Actor %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); $form_state->setRedirect( 'entity.oc_actor.canonical', ['oc_actor' => $this->revision->id()] diff --git a/modules/opencase_entities/src/Form/OCActorRevisionRevertForm.php b/modules/opencase_entities/src/Form/OCActorRevisionRevertForm.php index 0842dcd..e1de412 100644 --- a/modules/opencase_entities/src/Form/OCActorRevisionRevertForm.php +++ b/modules/opencase_entities/src/Form/OCActorRevisionRevertForm.php @@ -120,7 +120,7 @@ class OCActorRevisionRevertForm extends ConfirmFormBase { $this->revision->save(); $this->logger('content')->notice('Actor: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Actor %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + \Drupal::messenger()->addMessage(t('Actor %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); $form_state->setRedirect( 'entity.oc_actor.version_history', ['oc_actor' => $this->revision->id()] diff --git a/modules/opencase_entities/src/Form/OCActorTypeDeleteForm.php b/modules/opencase_entities/src/Form/OCActorTypeDeleteForm.php index 2fb46f9..74bdf36 100644 --- a/modules/opencase_entities/src/Form/OCActorTypeDeleteForm.php +++ b/modules/opencase_entities/src/Form/OCActorTypeDeleteForm.php @@ -38,7 +38,7 @@ class OCActorTypeDeleteForm extends EntityConfirmFormBase { public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - drupal_set_message( + \Drupal::messenger()->addMessage( $this->t('content @type: deleted @label.', [ '@type' => $this->entity->bundle(), diff --git a/modules/opencase_entities/src/Form/OCActorTypeForm.php b/modules/opencase_entities/src/Form/OCActorTypeForm.php index 92cff32..dbf1f73 100644 --- a/modules/opencase_entities/src/Form/OCActorTypeForm.php +++ b/modules/opencase_entities/src/Form/OCActorTypeForm.php @@ -49,13 +49,13 @@ class OCActorTypeForm extends EntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Person type.', [ + \Drupal::messenger()->addMessage($this->t('Created the %label Person type.', [ '%label' => $oc_actor_type->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Person type.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %label Person type.', [ '%label' => $oc_actor_type->label(), ])); } diff --git a/modules/opencase_entities/src/Form/OCEventForm.php b/modules/opencase_entities/src/Form/OCEventForm.php index 54affd1..c204446 100644 --- a/modules/opencase_entities/src/Form/OCEventForm.php +++ b/modules/opencase_entities/src/Form/OCEventForm.php @@ -62,7 +62,7 @@ class OCEventForm extends ContentEntityForm { } // If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied". if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished event entities')) { - drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [ + \Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [ '%label' => $entity->label(), ])); $form_state->setRedirect(''); diff --git a/modules/opencase_entities/src/Form/OCOrganisationForm.php b/modules/opencase_entities/src/Form/OCOrganisationForm.php index bf05881..652af4b 100644 --- a/modules/opencase_entities/src/Form/OCOrganisationForm.php +++ b/modules/opencase_entities/src/Form/OCOrganisationForm.php @@ -83,7 +83,7 @@ class OCOrganisationForm extends ContentEntityForm { } // If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied". if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished organisation entities')) { - drupal_set_message($this->t('The record for "%label" is now unpublished & hidden from you.', [ + \Drupal::messenger()->addMessage($this->t('The record for "%label" is now unpublished & hidden from you.', [ '%label' => $entity->label(), ])); $form_state->setRedirect(''); From 2411813bd6c006a90b1c78db3c473598dc37b334 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 27 Nov 2021 16:19:06 +0000 Subject: [PATCH 2/4] Added revision metadata keys for Drupal 9 --- modules/opencase_cases/src/Entity/OCCaseFee.php | 5 +++++ modules/opencase_cases/src/Entity/OCCaseProvision.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/opencase_cases/src/Entity/OCCaseFee.php b/modules/opencase_cases/src/Entity/OCCaseFee.php index 6eb0082..67f1b62 100644 --- a/modules/opencase_cases/src/Entity/OCCaseFee.php +++ b/modules/opencase_cases/src/Entity/OCCaseFee.php @@ -55,6 +55,11 @@ use Drupal\user\UserInterface; * "langcode" = "langcode", * "published" = "status", * }, + * revision_metadata_keys = { + * "revision_user" = "revision_user", + * "revision_created" = "revision_created", + * "revision_log_message" = "revision_log", + * }, * links = { * "canonical" = "/opencase/oc_case_fee/{oc_case_fee}", * "add-page" = "/opencase/oc_case_fee/add", diff --git a/modules/opencase_cases/src/Entity/OCCaseProvision.php b/modules/opencase_cases/src/Entity/OCCaseProvision.php index 75603cd..ddeafa6 100644 --- a/modules/opencase_cases/src/Entity/OCCaseProvision.php +++ b/modules/opencase_cases/src/Entity/OCCaseProvision.php @@ -55,6 +55,11 @@ use Drupal\user\UserInterface; * "langcode" = "langcode", * "published" = "status", * }, + * revision_metadata_keys = { + * "revision_user" = "revision_user", + * "revision_created" = "revision_created", + * "revision_log_message" = "revision_log", + * }, * links = { * "canonical" = "/opencase/oc_case_provision/{oc_case_provision}", * "add-page" = "/opencase/oc_case_provision/add", From cc2f03ddb3cea0a0bb7a0d696fe47de1a2fff52d Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 27 Nov 2021 17:22:05 +0000 Subject: [PATCH 3/4] versioning --- modules/opencase_cases/opencase_cases.info.yml | 2 +- modules/opencase_entities/opencase_entities.info.yml | 2 +- modules/opencase_search/opencase_search.info.yml | 2 +- opencase.info.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/opencase_cases/opencase_cases.info.yml b/modules/opencase_cases/opencase_cases.info.yml index 123c34f..3c5dd99 100644 --- a/modules/opencase_cases/opencase_cases.info.yml +++ b/modules/opencase_cases/opencase_cases.info.yml @@ -1,7 +1,7 @@ name: 'Opencase Cases' type: module description: 'Provides case entities and a required field on activities linking them to a case.' -core: 8.x +core_version_requirement: 9.x package: OpenCase dependencies: 0: opencase_entities diff --git a/modules/opencase_entities/opencase_entities.info.yml b/modules/opencase_entities/opencase_entities.info.yml index eefb7ab..b47bdf0 100644 --- a/modules/opencase_entities/opencase_entities.info.yml +++ b/modules/opencase_entities/opencase_entities.info.yml @@ -1,5 +1,5 @@ name: 'OpenCase Entities' type: module description: 'Entity Types for OpenCase' -core: 8.x +core_version_requirement: 9.x package: 'OpenCase' diff --git a/modules/opencase_search/opencase_search.info.yml b/modules/opencase_search/opencase_search.info.yml index cd4cb0d..3113a89 100644 --- a/modules/opencase_search/opencase_search.info.yml +++ b/modules/opencase_search/opencase_search.info.yml @@ -1,7 +1,7 @@ name: 'OpenCase Search' type: module description: 'Search functionality for OpenCase' -core: 8.x +core_version_requirement: 9.x package: 'OpenCase' dependencies: - search_api diff --git a/opencase.info.yml b/opencase.info.yml index d27aa80..f191356 100644 --- a/opencase.info.yml +++ b/opencase.info.yml @@ -1,8 +1,8 @@ name: 'OpenCase' type: module description: 'Simple Case Management' -core: 8.x -version: 8.x-3.0 +core_version_requirement: 9.x +version: 9.x-1.0 package: 'OpenCase' dependencies: - opencase_entities From 720b6f005dc801dd778c44985e574b8a0dc2e0cc Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 29 Nov 2021 18:18:15 +0000 Subject: [PATCH 4/4] removed duplicate permissions_callback key --- modules/opencase_cases/opencase_cases.permissions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/opencase_cases/opencase_cases.permissions.yml b/modules/opencase_cases/opencase_cases.permissions.yml index f2837fc..28f3f2b 100644 --- a/modules/opencase_cases/opencase_cases.permissions.yml +++ b/modules/opencase_cases/opencase_cases.permissions.yml @@ -29,8 +29,6 @@ delete all case provision revisions: title: 'Delete all revisions' description: 'Role requires permission to view Case Provision revisions and delete rights for case provision entities in question or administer case provision entities.' -permission_callbacks: - - \Drupal\opencase_cases\OCCaseProvisionPermissions::generatePermissions add case fee entities: title: 'Create new Case Fee entities' @@ -64,3 +62,4 @@ delete all case fee revisions: permission_callbacks: - \Drupal\opencase_cases\OCCaseFeePermissions::generatePermissions + - \Drupal\opencase_cases\OCCaseProvisionPermissions::generatePermissions