- Issue created by @gilles_webstanz
- Issue was unassigned.
- Status changed to Needs work
about 1 year ago 9:53pm 17 October 2023 - 🇨🇭Switzerland berdir Switzerland
That is indeed wrong, but it's actually job items, not jobs. See \Drupal\tmgmt\Entity\Job::requestTranslation(). And the @param type should not be array but class[]
- 🇧🇪Belgium gilles_webstanz
Hello @berdir,
Thank you for your help !
Here a new patch...
Hope it's good..
- 🇨🇭Switzerland berdir Switzerland
-
+++ b/tmgmt.api.php @@ -281,16 +281,19 @@ function hook_tmgmt_job_before_request_translation(JobInterface $job) { - * @param \Drupal\tmgmt\JobInterface $job + * @param JobInterface[] $job_items * The Job being submitted. */ -function hook_tmgmt_job_after_request_translation(JobInterface $job) { +function hook_tmgmt_job_after_request_translation($job_items) +{ /** @var \Drupal\tmgmt\Data $data_service */
types in @param definitions need to use full namespace, and the { must be on the same line.
-
+++ b/tmgmt.api.php @@ -281,16 +281,19 @@ function hook_tmgmt_job_before_request_translation(JobInterface $job) { // Reset the previous done changes to the data for example. - foreach ($job->getItems() as $job_item) { - $unfiltered_data = $job_item->getData(); + foreach ($job_items as $job) { + // Reset the previous done changes to the data for example. + /** @var JobInterface $job */ + $unfiltered_data = $job->getData();
$job is also a $job_item now, not a $job, the only thing that needs to change about the loop is that it's just $job_items as and not $job->getItems() as.
-
+++ b/tmgmt.api.php diff --git a/wrong-param-type-in-hook-job-after-request-translation-4.patch b/wrong-param-type-in-hook-job-after-request-translation-4.patch index 9c9ec99..e69de29 100644 index 9c9ec99..e69de29 100644 --- a/wrong-param-type-in-hook-job-after-request-translation-4.patch --- a/wrong-param-type-in-hook-job-after-request-translation-4.patch +++ b/wrong-param-type-in-hook-job-after-request-translation-4.patch +++ b/wrong-param-type-in-hook-job-after-request-translation-4.patch +++ b/wrong-param-type-in-hook-job-after-request-translation-4.patch @@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@ -diff --git a/tmgmt.api.php b/tmgmt.api.php -index 971dec0..e810160 100644 ---- a/tmgmt.api.php -+++ b/tmgmt.api.php -@@ -281,19 +281,23 @@ function hook_tmgmt_job_before_request_translation(JobInterface $job) { - /** - * Allows to alter job checkout workflow after the default behavior.
your patch includes a patch file.
-