From 14d0ed7722113edf8014da4f07e3ae9627a7db69 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Thu, 12 Sep 2024 14:37:52 +0300 Subject: [PATCH 01/14] UHF-10554: Prefer english when content does not have translation to current language --- conf/cmi/language.entity.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/cmi/language.entity.en.yml b/conf/cmi/language.entity.en.yml index 2a8baa88f..1c4adca09 100644 --- a/conf/cmi/language.entity.en.yml +++ b/conf/cmi/language.entity.en.yml @@ -7,5 +7,5 @@ _core: id: en label: English direction: ltr -weight: -8 +weight: -11 locked: false From a585703d88a14c00fe9cb82a90bfc6bcac6bad92 Mon Sep 17 00:00:00 2001 From: hel-platta-automation <95360595+hel-platta-automation@users.noreply.github.com> Date: Mon, 16 Sep 2024 06:16:26 +0000 Subject: [PATCH 02/14] Update configuration --- composer.lock | 95 +++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/composer.lock b/composer.lock index 52e1d703c..0f50d7afc 100644 --- a/composer.lock +++ b/composer.lock @@ -2364,16 +2364,16 @@ }, { "name": "drupal/core", - "version": "10.3.3", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "900f85d93564fa8bea99519c11b564b22df7fb97" + "reference": "831a269a4d99957638977ec325c3346f896d9f08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/900f85d93564fa8bea99519c11b564b22df7fb97", - "reference": "900f85d93564fa8bea99519c11b564b22df7fb97", + "url": "https://api.github.com/repos/drupal/core/zipball/831a269a4d99957638977ec325c3346f896d9f08", + "reference": "831a269a4d99957638977ec325c3346f896d9f08", "shasum": "" }, "require": { @@ -2419,7 +2419,7 @@ "symfony/serializer": "^6.4", "symfony/validator": "^6.4", "symfony/yaml": "^6.4", - "twig/twig": "^3.9.3" + "twig/twig": "^3.14.0" }, "conflict": { "drush/drush": "<12.4.3" @@ -2522,13 +2522,13 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/10.3.3" + "source": "https://github.com/drupal/core/tree/10.3.5" }, - "time": "2024-09-05T08:50:05+00:00" + "time": "2024-09-12T09:45:37+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "10.3.3", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", @@ -2572,7 +2572,7 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.3" + "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.5" }, "time": "2024-08-22T14:31:34+00:00" }, @@ -3855,6 +3855,10 @@ "name": "hydra", "homepage": "https://www.drupal.org/user/647364" }, + { + "name": "joevagyok", + "homepage": "https://www.drupal.org/user/2876343" + }, { "name": "jyve", "homepage": "https://www.drupal.org/user/591438" @@ -4578,16 +4582,16 @@ }, { "name": "drupal/helfi_platform_config", - "version": "4.6.2", + "version": "4.6.3", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config.git", - "reference": "ae51b8d0a47482c73640b0061e0facb6240bfd64" + "reference": "9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/ae51b8d0a47482c73640b0061e0facb6240bfd64", - "reference": "ae51b8d0a47482c73640b0061e0facb6240bfd64", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611", + "reference": "9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611", "shasum": "" }, "require": { @@ -4705,10 +4709,10 @@ ], "description": "HELfi platform config", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.2", + "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.3", "issues": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/issues" }, - "time": "2024-09-10T06:28:24+00:00" + "time": "2024-09-12T12:49:04+00:00" }, { "name": "drupal/helfi_proxy", @@ -5466,7 +5470,7 @@ ], "authors": [ { - "name": "Cellar Door", + "name": "cellar door", "homepage": "https://www.drupal.org/user/658076" }, { @@ -5763,7 +5767,7 @@ "role": "Developer" }, { - "name": "Dave Reid", + "name": "dave reid", "homepage": "https://www.drupal.org/user/53892" } ], @@ -7024,26 +7028,29 @@ }, { "name": "drupal/role_delegation", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/role_delegation.git", - "reference": "8.x-1.2" + "reference": "8.x-1.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/role_delegation-8.x-1.2.zip", - "reference": "8.x-1.2", - "shasum": "08095bada0f492e70d32fcf357a8c01825ca81fc" + "url": "https://ftp.drupal.org/files/projects/role_delegation-8.x-1.3.zip", + "reference": "8.x-1.3", + "shasum": "e03d9c82d509a2630750e50a3452bd70ca1c55a6" }, "require": { - "drupal/core": "^9.2 || ^10" + "drupal/core": "^10.3 || ^11" + }, + "require-dev": { + "drupal/action": "^0.2" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.2", - "datestamp": "1644487627", + "version": "8.x-1.3", + "datestamp": "1726236826", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -7061,7 +7068,7 @@ "role": "Maintainer" }, { - "name": "JeroenT", + "name": "jeroent", "homepage": "https://www.drupal.org/user/2228934" } ], @@ -10818,16 +10825,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -10870,9 +10877,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "nodespark/des-connector", @@ -11550,16 +11557,16 @@ }, { "name": "phrity/util-errorhandler", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sirn-se/phrity-util-errorhandler.git", - "reference": "4016d9f9615a4c602f525b0542e4835e316a42e4" + "reference": "483228156e06673963902b1cc1e6bd9541ab4d5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirn-se/phrity-util-errorhandler/zipball/4016d9f9615a4c602f525b0542e4835e316a42e4", - "reference": "4016d9f9615a4c602f525b0542e4835e316a42e4", + "url": "https://api.github.com/repos/sirn-se/phrity-util-errorhandler/zipball/483228156e06673963902b1cc1e6bd9541ab4d5e", + "reference": "483228156e06673963902b1cc1e6bd9541ab4d5e", "shasum": "" }, "require": { @@ -11595,9 +11602,9 @@ ], "support": { "issues": "https://github.com/sirn-se/phrity-util-errorhandler/issues", - "source": "https://github.com/sirn-se/phrity-util-errorhandler/tree/1.1.0" + "source": "https://github.com/sirn-se/phrity-util-errorhandler/tree/1.1.1" }, - "time": "2024-03-05T19:32:14+00:00" + "time": "2024-09-12T06:49:16+00:00" }, { "name": "psr/cache", @@ -11913,16 +11920,16 @@ }, { "name": "psr/log", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "79dff0b268932c640297f5208d6298f71855c03e" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", - "reference": "79dff0b268932c640297f5208d6298f71855c03e", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -11957,9 +11964,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.1" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-08-21T13:31:24+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "psy/psysh", From ba14a65c51501c88d099e847e975aa508f565654 Mon Sep 17 00:00:00 2001 From: hel-platta-automation <95360595+hel-platta-automation@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:31:40 +0000 Subject: [PATCH 03/14] Update configuration --- composer.lock | 83 ++++++++++--------- ...e_compliance.cookie_category.essential.yml | 4 +- ...cookie_compliance.cookie_category.chat.yml | 2 +- ...e_compliance.cookie_category.essential.yml | 2 +- ..._compliance.cookie_category.statistics.yml | 2 +- ...cookie_compliance.cookie_category.chat.yml | 2 +- ...e_compliance.cookie_category.essential.yml | 2 +- ..._compliance.cookie_category.statistics.yml | 2 +- 8 files changed, 51 insertions(+), 48 deletions(-) diff --git a/composer.lock b/composer.lock index 0f50d7afc..b1ea2e7b4 100644 --- a/composer.lock +++ b/composer.lock @@ -3087,17 +3087,17 @@ }, { "name": "drupal/editoria11y", - "version": "2.1.18", + "version": "2.1.19", "source": { "type": "git", "url": "https://git.drupalcode.org/project/editoria11y.git", - "reference": "2.1.18" + "reference": "2.1.19" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/editoria11y-2.1.18.zip", - "reference": "2.1.18", - "shasum": "ebdb25f92c2d77681661216ca3abebbc710b662a" + "url": "https://ftp.drupal.org/files/projects/editoria11y-2.1.19.zip", + "reference": "2.1.19", + "shasum": "0ccf651071837e1ee6fcfb8fbb1c279d2fc1bc27" }, "require": { "drupal/core": "^9 || ^10 || ^11" @@ -3108,8 +3108,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.1.18", - "datestamp": "1716399461", + "version": "2.1.19", + "datestamp": "1726514804", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4249,16 +4249,16 @@ }, { "name": "drupal/hdbt", - "version": "6.7.1", + "version": "6.7.2", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-hdbt.git", - "reference": "55aed30d55539384ad0425d46838b48423496172" + "reference": "fc4412873b2fcac8af2bad7d1387b850424d6dc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/55aed30d55539384ad0425d46838b48423496172", - "reference": "55aed30d55539384ad0425d46838b48423496172", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/fc4412873b2fcac8af2bad7d1387b850424d6dc1", + "reference": "fc4412873b2fcac8af2bad7d1387b850424d6dc1", "shasum": "" }, "require": { @@ -4277,10 +4277,10 @@ "Drupal" ], "support": { - "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/6.7.1", + "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/6.7.2", "issues": "https://github.com/City-of-Helsinki/drupal-hdbt/issues" }, - "time": "2024-09-10T07:40:47+00:00" + "time": "2024-09-19T13:24:34+00:00" }, { "name": "drupal/hdbt_admin", @@ -4582,16 +4582,16 @@ }, { "name": "drupal/helfi_platform_config", - "version": "4.6.3", + "version": "4.6.4", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config.git", - "reference": "9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611" + "reference": "a5e8ef073740c91b4e8082ebf9901fa5c05f70cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611", - "reference": "9e9b0e9d0ae516ac3e7a79c7bf35fc1d83f93611", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/a5e8ef073740c91b4e8082ebf9901fa5c05f70cf", + "reference": "a5e8ef073740c91b4e8082ebf9901fa5c05f70cf", "shasum": "" }, "require": { @@ -4709,10 +4709,10 @@ ], "description": "HELfi platform config", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.3", + "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.4", "issues": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/issues" }, - "time": "2024-09-12T12:49:04+00:00" + "time": "2024-09-18T06:15:59+00:00" }, { "name": "drupal/helfi_proxy", @@ -6339,20 +6339,20 @@ }, { "name": "drupal/paragraphs_asymmetric_translation_widgets", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/paragraphs_asymmetric_translation_widgets.git", - "reference": "8.x-1.3" + "reference": "8.x-1.4" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/paragraphs_asymmetric_translation_widgets-8.x-1.3.zip", - "reference": "8.x-1.3", - "shasum": "adeec4a2cd6f06e01dd5dcac27c39fad986ca80f" + "url": "https://ftp.drupal.org/files/projects/paragraphs_asymmetric_translation_widgets-8.x-1.4.zip", + "reference": "8.x-1.4", + "shasum": "3b09fb13d2bd0bb351cf98fdae1b27eab8032984" }, "require": { - "drupal/core": "^9.3 || ^10", + "drupal/core": "^9.3 || ^10 || ^11", "drupal/paragraphs": "~1.15" }, "require-dev": { @@ -6364,8 +6364,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.3", - "datestamp": "1702031259", + "version": "8.x-1.4", + "datestamp": "1726511423", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -6374,7 +6374,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0" + "GPL-2.0-or-later" ], "authors": [ { @@ -6386,7 +6386,7 @@ "homepage": "https://www.drupal.org/user/1567500" }, { - "name": "Grayle", + "name": "grayle", "homepage": "https://www.drupal.org/user/3145497" }, { @@ -6394,7 +6394,7 @@ "homepage": "https://www.drupal.org/user/959536" }, { - "name": "Rajab Natshah", + "name": "rajab natshah", "homepage": "https://www.drupal.org/user/1414312" }, { @@ -6668,33 +6668,32 @@ }, { "name": "drupal/raven", - "version": "5.0.17", + "version": "5.0.18", "source": { "type": "git", "url": "https://git.drupalcode.org/project/raven.git", - "reference": "5.0.17" + "reference": "5.0.18" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/raven-5.0.17.zip", - "reference": "5.0.17", - "shasum": "3be77024ab4edac4964ed5a4590f4e9eb5031346" + "url": "https://ftp.drupal.org/files/projects/raven-5.0.18.zip", + "reference": "5.0.18", + "shasum": "7107a602cb87e4f652991e66d5083f876defa4d1" }, "require": { "drupal/core": "^10.1 || ^11", - "sentry/sentry": "^4.4" + "sentry/sentry": "^4.9" }, "require-dev": { "drupal/csp": "^1.17 || ^2.0", - "drupal/monitoring": "^1.13", "drupal/seckit": "^2.0", "drush/drush": "^11.0 || ^12.0 || ^13.0" }, "type": "drupal-module", "extra": { "drupal": { - "version": "5.0.17", - "datestamp": "1723776489", + "version": "5.0.18", + "datestamp": "1726679171", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -7067,6 +7066,10 @@ "homepage": "https://www.drupal.org/u/jeroent", "role": "Maintainer" }, + { + "name": "benjy", + "homepage": "https://www.drupal.org/user/1852732" + }, { "name": "jeroent", "homepage": "https://www.drupal.org/user/2228934" @@ -8423,7 +8426,7 @@ "homepage": "https://www.drupal.org/u/graber" }, { - "name": "Graber", + "name": "graber", "homepage": "https://www.drupal.org/user/1599440" }, { diff --git a/conf/cmi/eu_cookie_compliance.cookie_category.essential.yml b/conf/cmi/eu_cookie_compliance.cookie_category.essential.yml index fa3829302..e4ac108ef 100644 --- a/conf/cmi/eu_cookie_compliance.cookie_category.essential.yml +++ b/conf/cmi/eu_cookie_compliance.cookie_category.essential.yml @@ -3,11 +3,11 @@ langcode: en status: true dependencies: { } _core: - default_config_hash: kfnLYqpxtvBYopdnyeB0TYzlfLynAY6hIegpzFNdDKw + default_config_hash: tsGLdAqnFNOsUkYbiBTtLnQLwrg4ySe6BnJzSBpAkFk id: essential label: 'Essential cookies' description: - value: '

Essential cookies help to make the website usable by allowing basic functions, navigating the page and using the protected areas of the site. The website will not work properly without these cookies and their consent is not required.

NameProviderPurpose of the cookieValidityType
cookiehubcookiehub.comUsed by CookieHub to store information about whether visitors have given or declined the use of cookie categories used on the www.hel.fi site.365 days 
cookie-agreedwww.hel.fiUsed by www.hel.fi Drupal to store information about whether visitors have given or declined the use of cookie categories used on the www.hel.fi site.100 days 
cookie-agreed-versionwww.hel.fiUsed by www.hel.fi Drupal to store information about what version of the cookie consent the user has agreed to.100 days 
cookie-agreed-categorieswww.hel.fiUsed by www.hel.fi Drupal to store information about what cookie categories the user has agreed to.100 days 
cookie-agreedavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about whether visitors have given or declined the use of cookie categories used on the avustukset.hel.fi site.100 days 
cookie-agreed-versionavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about what version of the cookie consent the user has agreed to.100 days 
cookie-agreed-categoriesavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about what cookie categories the user has agreed to.100 days 
SSESS*www.hel.fiA cookie related to the operation of the content management system.23 days 
SSESS*avustukset.hel.fiA cookie related to the operation of the content management system.23 days 
AWSELBCORSsiteimproveanalytics.ioThe cookie is related to a load distribution function used to direct requests to servers with the least traffic.SessionThird party
mtm_cookie_consentkartta.hel.fiA technical cookie that stores information about how you responded to the notice in the cookie banner about the use of cookies.10950 days 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

The cookie is an obligatory cookie that facilitates visiting the website.SessionThird party
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudUsed for chat app functionality. Its value is used to access session data on server of the application.SessionThird party
COOKIE_SUPPORThelsinkikanava.fiThe cookie facilitates managing cookies on the website.365 daysThird party
GUEST_LANGUAGE_IDhelsinkikanava.fiThis cookie is generated by the Liferay, its function is to store the language preferences.365 daysThird party
helfi-settingswww.hel.fiUsed by www.hel.fi Drupal to store information about closed announcements and accordions'' state.-Local storage
Drupal.visitor.autologout_loginavustukset.hel.fiUsed by avustukset.hel.fi Drupal to automatically logout user after a period of inactivity.365 days 
' + value: '

Essential cookies help to make the website usable by allowing basic functions, navigating the page and using the protected areas of the site. The website will not work properly without these cookies and their consent is not required.

NameProviderPurpose of the cookieValidityType
cookiehubcookiehub.comUsed by CookieHub to store information about whether visitors have given or declined the use of cookie categories used on the www.hel.fi site.365 days 
cookie-agreedwww.hel.fiUsed by www.hel.fi Drupal to store information about whether visitors have given or declined the use of cookie categories used on the www.hel.fi site.100 days 
cookie-agreed-versionwww.hel.fiUsed by www.hel.fi Drupal to store information about what version of the cookie consent the user has agreed to.100 days 
cookie-agreed-categorieswww.hel.fiUsed by www.hel.fi Drupal to store information about what cookie categories the user has agreed to.100 days 
cookie-agreedavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about whether visitors have given or declined the use of cookie categories used on the avustukset.hel.fi site.100 days 
cookie-agreed-versionavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about what version of the cookie consent the user has agreed to.100 days 
cookie-agreed-categoriesavustukset.hel.fiUsed by avustukset.hel.fi Drupal to store information about what cookie categories the user has agreed to.100 days 
SSESS*www.hel.fiA cookie related to the operation of the content management system.23 days 
SSESS*avustukset.hel.fiA cookie related to the operation of the content management system.23 days 
AWSELBCORSsiteimproveanalytics.ioThe cookie is related to a load distribution function used to direct requests to servers with the least traffic.SessionThird party
mtm_cookie_consentkartta.hel.fiA technical cookie that stores information about how you responded to the notice in the cookie banner about the use of cookies.10950 days 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

The cookie is an obligatory cookie that facilitates visiting the website.SessionThird party
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudUsed for chat app functionality. Its value is used to access session data on server of the application.SessionThird party
COOKIE_SUPPORThelsinkikanava.fiThe cookie facilitates managing cookies on the website.365 daysThird party
GUEST_LANGUAGE_IDhelsinkikanava.fiThis cookie is generated by the Liferay, its function is to store the language preferences.365 daysThird party
helfi-settingswww.hel.fiUsed by www.hel.fi Drupal to store information about closed announcements and accordions'' state.-Local storage
Drupal.visitor.autologout_loginavustukset.hel.fiUsed by avustukset.hel.fi Drupal to automatically logout user after a period of inactivity.365 days 
editoria11yResultCountwww.hel.fiTracks accessibility issues for the current page when logged in as an editor on hel.fi.-Local storage
Drupal.gin.sidebarExpanded.desktopwww.hel.fiStores whether the admin sidebar is expanded or collapsed on desktop when logged in as an editor on hel.fi.-Local storage
Drupal.gin.sidebarExpanded.mobilewww.hel.fiStores whether the admin sidebar is expanded or collapsed on mobile when logged in as an editor on hel.fi.-Local storage
Drupal.gin.darkmodewww.hel.fiStores the user''s dark mode preference in the admin theme when logged in as an editor on hel.fi.-Local storage
Drupal.toolbar.subtrees.*www.hel.fiStores the expanded or collapsed state of submenus in the Drupal admin toolbar for a logged-in editor, ensuring consistency across page loads.-Local storage
Drupal.off-canvas.css.*www.hel.fiStores cached CKEditor CSS in localStorage for a logged-in editor, using a key with a cache-busting query to ensure the latest CSS is loaded.-Local storage
ed11ySeenwww.hel.fiTracks which accessibility issues a logged-in editor has already seen to avoid duplicate notifications.-Local storage
editoria11yResultCountwww.hel.fiTracks the number of accessibility issues found on specific pages for a logged-in editor, helping monitor and address them.-Local storage
Drupal.toolbar.toolbarStatewww.hel.fiStores the state of the admin toolbar for a logged-in editor, including its orientation, active tab and state of expansion.SessionSession storage
escapeAdminPathwww.hel.fiStores the URL to redirect a logged-in editor from the admin interface back to the main site.SessionSession storage
' format: full_html checkbox_default_state: required weight: -9 diff --git a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.chat.yml b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.chat.yml index e384bffd3..af36726d9 100644 --- a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.chat.yml +++ b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.chat.yml @@ -1,4 +1,4 @@ description: - value: '

Toiminnallisten chat-evästeiden avulla mahdollistetaan helfi-sivujen chattien toiminta. Jos aloitat chatin, hyväksyt sen käyttöön liittyvät toiminnalliset evästeet automaattisesti.  Evästeiden hyväksymiseen ei tällöin tarvita erillistä suostumusta. Toiminnallisia chat-evästeitä ladataan laitteellesi vain, jos käynnistät chatin.

NimiTarjoajaTarkoitusVoimassaTyyppi
_genesys.widgets.*www.hel.fiKäytetään chatin tarvitseman datan tallentamiseen.Istunto 
leijuke.*www.hel.fiKäytetään chatin tarvitseman datan tallentamiseen.Istunto 
aiap-wbc-chat-app-button-statewww.hel.fiKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen painikkeen asetukset ja kokoonpanotiedot.Istunto 
aiap-chat-app-v1-statewww.hel.fiKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen asetukset ja kokoonpanotiedot.Istunto 
conversationTokenhttps://coh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen keskustelutunnisteen istunnnon tunnistamista ja tietojen hakemista varten.IstuntoKolmas osapuoli
CallGuide.languagewww.hel.fiACE Chat: ACE Web SDK:ssa käytettävä kieli, joka on johdettu selainten ensisijaisesta kieliasetuksesta ja ACE Web SDK - asetuksista.-Paikallinen muisti
CallGuide.config_services_*www.hel.fiACE Chat: Asiakaspalveluintegraatioiden määritys verkkosivulla. Vähentää verkkoliikennettä sivun lataamisen ja navigoinnin yhteydessä.-Paikallinen muisti
*_CGWebSDK_windowGUIDwds.ace.teliacompany.comACE Chat: Tämän selainikkunan yksilöllinen identiteetti. Käytetään, jos selaimessa on useampi kuin yksi avoin ikkuna verkkosivustolle.-Paikallinen muisti
*_CGWebSDK_videoShowerwds.ace.teliacompany.comACE Chat: Vain yksi ikkuna kerrallaan voi näyttää videota. Nämä tiedot seuraavat, mikä niistä (jos sellainen on).-Paikallinen muisti
*_CGWebSDK_videoClientswds.ace.teliacompany.comACE Chat: Luettelo kaikista ikkunoista, jotka ovat todennäköisiä videon näyttämiseen.-Paikallinen muisti
*_ACEChatState_ActiveClientwds.ace.teliacompany.comACE Chat: Verkkosivustolla voi olla useampi kuin yksi chat-asiakasohjelma. Tämä kohde seuraa, mihin asiakkaaseen nykyinen chat kuuluu.-Paikallinen muisti
*_chatEntrancewds.ace.teliacompany.comACE Chat: Järjestelmän chat-sisäänkäynnin nimi-Paikallinen muisti
*_chatUIDwds.ace.teliacompany.comACE Chat: Keskustelun istuntotunnus kommunikoitaessa ACE:n kanssa-Paikallinen muisti
humany-*www.hel.fiACE Chat: Säilyttää widgetin tilan, kun sivu ladataan uudelleen -Paikallinen muisti
ARRAffinity.hel.humany.netACE Chat: Kuormituksen tasaus taustajärjestelmässäIstuntoKolmas osapuoli
ARRAffinitySameSite.hel.humany.netACE Chat: Kuormituksen tasaus taustajärjestelmässäIstuntoKolmas osapuoli
' + value: '

Toiminnallisten chat-evästeiden avulla mahdollistetaan helfi-sivujen chattien toiminta. Jos aloitat chatin, hyväksyt sen käyttöön liittyvät toiminnalliset evästeet automaattisesti.  Evästeiden hyväksymiseen ei tällöin tarvita erillistä suostumusta. Toiminnallisia chat-evästeitä ladataan laitteellesi vain, jos käynnistät chatin.

NimiTarjoajaTarkoitusVoimassaTyyppi
_genesys.widgets.*www.hel.fiKäytetään chatin tarvitseman datan tallentamiseen.Istunto 
leijuke.*www.hel.fiKäytetään chatin tarvitseman datan tallentamiseen.Istunto 
aiap-wbc-chat-app-button-statewww.hel.fiKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen painikkeen asetukset ja kokoonpanotiedot.Istunto 
aiap-chat-app-v1-statewww.hel.fiKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen asetukset ja kokoonpanotiedot.Istunto 
conversationTokenhttps://coh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudKäytetään chat-sovellustoiminnallisuutta varten. Säilyttää chat-sovelluksen keskustelutunnisteen istunnnon tunnistamista ja tietojen hakemista varten.IstuntoKolmas osapuoli
CallGuide.languagewww.hel.fiACE Chat: ACE Web SDK:ssa käytettävä kieli, joka on johdettu selainten ensisijaisesta kieliasetuksesta ja ACE Web SDK - asetuksista.-Tallennetaan käyttäjän laitteelle
CallGuide.config_services_*www.hel.fiACE Chat: Asiakaspalveluintegraatioiden määritys verkkosivulla. Vähentää verkkoliikennettä sivun lataamisen ja navigoinnin yhteydessä.-Tallennetaan käyttäjän laitteelle
*_CGWebSDK_windowGUIDwds.ace.teliacompany.comACE Chat: Tämän selainikkunan yksilöllinen identiteetti. Käytetään, jos selaimessa on useampi kuin yksi avoin ikkuna verkkosivustolle.-Tallennetaan käyttäjän laitteelle
*_CGWebSDK_videoShowerwds.ace.teliacompany.comACE Chat: Vain yksi ikkuna kerrallaan voi näyttää videota. Nämä tiedot seuraavat, mikä niistä (jos sellainen on).-Tallennetaan käyttäjän laitteelle
*_CGWebSDK_videoClientswds.ace.teliacompany.comACE Chat: Luettelo kaikista ikkunoista, jotka ovat todennäköisiä videon näyttämiseen.-Tallennetaan käyttäjän laitteelle
*_ACEChatState_ActiveClientwds.ace.teliacompany.comACE Chat: Verkkosivustolla voi olla useampi kuin yksi chat-asiakasohjelma. Tämä kohde seuraa, mihin asiakkaaseen nykyinen chat kuuluu.-Tallennetaan käyttäjän laitteelle
*_chatEntrancewds.ace.teliacompany.comACE Chat: Järjestelmän chat-sisäänkäynnin nimi-Tallennetaan käyttäjän laitteelle
*_chatUIDwds.ace.teliacompany.comACE Chat: Keskustelun istuntotunnus kommunikoitaessa ACE:n kanssa-Tallennetaan käyttäjän laitteelle
humany-*www.hel.fiACE Chat: Säilyttää widgetin tilan, kun sivu ladataan uudelleen -Tallennetaan käyttäjän laitteelle
ARRAffinity.hel.humany.netACE Chat: Kuormituksen tasaus taustajärjestelmässäIstuntoKolmas osapuoli
ARRAffinitySameSite.hel.humany.netACE Chat: Kuormituksen tasaus taustajärjestelmässäIstuntoKolmas osapuoli
' format: full_html label: 'Toiminnalliset chat-evästeet' diff --git a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.essential.yml b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.essential.yml index f66aa525a..ef55729f0 100644 --- a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.essential.yml +++ b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.essential.yml @@ -1,4 +1,4 @@ description: - value: '

Välttämättömät evästeet auttavat tekemään verkkosivustosta käyttökelpoisen sallimalla perustoimintoja, kuten sivulla siirtymisen ja sivuston suojattujen alueiden käytön. Verkkosivusto ei toimi kunnolla ilman näitä evästeitä eikä niihin tarvita suostumusta.

NimiTarjoajaTarkoitusVoimassaTyyppi
cookiehubCookiehubMahdollistaa evästehallinnan www.hel.fi sivuilla.365 päivää 
cookie-agreedwww.hel.fiSivusto käyttää tätä evästettä tietojen tallentamiseen siitä, ovatko kävijät antaneet hyväksyntänsä tai kieltäytyneet evästeiden käytöstä.100 päivää 
cookie-agreed-versionwww.hel.fiTähän evästeeseen tallennetaan käyttäjän hyväksymän evästeselosteen versio.100 päivää 
cookie-agreed-categorieswww.hel.fiTähän evästeeseen on tallennettu käyttäjän hyväksymät evästekategoriat.100 päivää 
cookie-agreedavustukset.hel.fiSivusto käyttää tätä evästettä tietojen tallentamiseen siitä, ovatko kävijät antaneet hyväksyntänsä tai kieltäytyneet evästeiden käytöstä.100 päivää 
cookie-agreed-versionavustukset.hel.fiTähän evästeeseen tallennetaan käyttäjän hyväksymän evästeselosteen versio.100 päivää 
cookie-agreed-categoriesavustukset.hel.fiTähän evästeeseen on tallennettu käyttäjän hyväksymät evästekategoriat.100 päivää 
SSESS*www.hel.fiSisällönhallintajärjestelmän toimintaan liittyvä eväste.23 päivää 
SSESS*avustukset.hel.fiSisällönhallintajärjestelmän toimintaan liittyvä eväste.23 päivää 
AWSELBCORSsiteimproveanalytics.ioEväste liittyy palvelinten kuormanjakotoiminnallisuuteen, jolla ohjataan pyynnöt vähimmällä käytöllä olevalle palvelimille.IstuntoKolmas osapuoli
mtm_cookie_consentkartta.hel.fiTekninen eväste johon talletetaan tieto valinnastasi evästeiden käytöstä kertovan bannerin kohdalla10950 päivää 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

Sivuston pakollinen eväste mahdollistaa kävijän vierailun sivustolla.IstuntoKolmas osapuoli
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudKäytetään chat-sovellustoiminnallisuutta varten. Evästettä käytetään sovelluksen palvelimella olevan istuntotiedon hakemiseen.IstuntoKolmas osapuoli
COOKIE_SUPPORThelsinkikanava.fiMahdollistaa evästeiden hallinnan sivustolla.365 päivääKolmas osapuoli
GUEST_LANGUAGE_IDhelsinkikanava.fiTämän evästeen on luonut Liferay, se tallentaa kieliasetukset.365 päivääKolmas osapuoli
helfi-settingswww.hel.fiSivusto käyttää tätä tietuetta tietojen tallentamiseen siitä, mitä poikkeusilmoituksia on suljettu ja mikä on avattavien sisältöalueiden tila.-Paikallinen muisti
Drupal.visitor.autologout_loginavustukset.hel.fiKäytetään käyttäjän automaattiseen uloskirjautumiseen.365 päivää 
' + value: '

Välttämättömät evästeet auttavat tekemään verkkosivustosta käyttökelpoisen sallimalla perustoimintoja, kuten sivulla siirtymisen ja sivuston suojattujen alueiden käytön. Verkkosivusto ei toimi kunnolla ilman näitä evästeitä eikä niihin tarvita suostumusta.

NimiTarjoajaTarkoitusVoimassaTyyppi
cookiehubCookiehubMahdollistaa evästehallinnan www.hel.fi sivuilla.365 päivää 
cookie-agreedwww.hel.fiSivusto käyttää tätä evästettä tietojen tallentamiseen siitä, ovatko kävijät antaneet hyväksyntänsä tai kieltäytyneet evästeiden käytöstä.100 päivää 
cookie-agreed-versionwww.hel.fiTähän evästeeseen tallennetaan käyttäjän hyväksymän evästeselosteen versio.100 päivää 
cookie-agreed-categorieswww.hel.fiTähän evästeeseen on tallennettu käyttäjän hyväksymät evästekategoriat.100 päivää 
cookie-agreedavustukset.hel.fiSivusto käyttää tätä evästettä tietojen tallentamiseen siitä, ovatko kävijät antaneet hyväksyntänsä tai kieltäytyneet evästeiden käytöstä.100 päivää 
cookie-agreed-versionavustukset.hel.fiTähän evästeeseen tallennetaan käyttäjän hyväksymän evästeselosteen versio.100 päivää 
cookie-agreed-categoriesavustukset.hel.fiTähän evästeeseen on tallennettu käyttäjän hyväksymät evästekategoriat.100 päivää 
SSESS*www.hel.fiSisällönhallintajärjestelmän toimintaan liittyvä eväste.23 päivää 
SSESS*avustukset.hel.fiSisällönhallintajärjestelmän toimintaan liittyvä eväste.23 päivää 
AWSELBCORSsiteimproveanalytics.ioEväste liittyy palvelinten kuormanjakotoiminnallisuuteen, jolla ohjataan pyynnöt vähimmällä käytöllä olevalle palvelimille.IstuntoKolmas osapuoli
mtm_cookie_consentkartta.hel.fiTekninen eväste johon talletetaan tieto valinnastasi evästeiden käytöstä kertovan bannerin kohdalla10950 päivää 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

Sivuston pakollinen eväste mahdollistaa kävijän vierailun sivustolla.IstuntoKolmas osapuoli
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudKäytetään chat-sovellustoiminnallisuutta varten. Evästettä käytetään sovelluksen palvelimella olevan istuntotiedon hakemiseen.IstuntoKolmas osapuoli
COOKIE_SUPPORThelsinkikanava.fiMahdollistaa evästeiden hallinnan sivustolla.365 päivääKolmas osapuoli
GUEST_LANGUAGE_IDhelsinkikanava.fiTämän evästeen on luonut Liferay, se tallentaa kieliasetukset.365 päivääKolmas osapuoli
helfi-settingswww.hel.fiSivusto käyttää tätä tietuetta tietojen tallentamiseen siitä, mitä poikkeusilmoituksia on suljettu ja mikä on avattavien sisältöalueiden tila.-Tallennetaan käyttäjän laitteelle
Drupal.visitor.autologout_loginavustukset.hel.fiKäytetään käyttäjän automaattiseen uloskirjautumiseen.365 päivää 
editoria11yResultCountwww.hel.fiTallentaa sisällöntuottajan näkemien saavutettavuusongelmien lukumäärän nykyisellä sivulla.-Tallennetaan käyttäjän laitteelle
Drupal.gin.sidebarExpanded.desktopwww.hel.fiTallentaa tiedon sisällöntuottajan käyttöliittymän sivupalkin näkyvyydestä työpöytänäkymässä.-Tallennetaan käyttäjän laitteelle
Drupal.gin.sidebarExpanded.mobilewww.hel.fiTallentaa tiedon sisällöntuottajan käyttöliittymän sivupalkin näkyvyydestä mobiilinäkymässä.-Tallennetaan käyttäjän laitteelle
Drupal.gin.darkmodewww.hel.fiTallentaa tiedon sisällöntuottajan valitsemasta "tumma tila"-asetuksesta.-Tallennetaan käyttäjän laitteelle
Drupal.toolbar.subtrees.*www.hel.fiTallentaa sisällöntuottajan näkymissä alivalikoiden tilan (laajennettu tai kutistettu), jotta se säilyy yhdenmukaisena sivulatausten välillä.-Tallennetaan käyttäjän laitteelle
Drupal.off-canvas.css.*www.hel.fiTallentaa sisällöntuottajan käyttämän wysiwyg-editorin tyylit välimuistiin varmistaakseen viimeisimpien CSS-tyylien latauksen.-Tallennetaan käyttäjän laitteelle
ed11ySeenwww.hel.fiTallentaa sisällöntuottajan näkemät saavutettavuusongelmat, jotta vältetään ongelmien kaksoisilmoitukset.-Tallennetaan käyttäjän laitteelle
editoria11yResultCountwww.hel.fiTallentaa löydettyjen saavutettavuusongelmien määrän sisällöntuottajalle, auttaen seuraamaan ja korjaamaan ne.-Tallennetaan käyttäjän laitteelle
Drupal.toolbar.toolbarStatewww.hel.fiTallentaa sisällöntuottajan hallintatyökalupalkin orientaation, aktiivisen välilehden ja laajennustilan.IstuntoTallennetaan käyttäjän laitteelle istunnon ajaksi
escapeAdminPathwww.hel.fiTallentaa URL-osoitteen, jota käytetään ohjaamaan kirjautunut sisällöntuottaja hallintaliittymästä takaisin pääsivustolle.IstuntoTallennetaan käyttäjän laitteelle istunnon ajaksi
' format: full_html label: 'Välttämättömät toiminnalliset evästeet' diff --git a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.statistics.yml b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.statistics.yml index 4d0e745ec..d77a2f75a 100644 --- a/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.statistics.yml +++ b/conf/cmi/language/fi/eu_cookie_compliance.cookie_category.statistics.yml @@ -1,4 +1,4 @@ description: - value: '

Tilastointievästeiden keräämää tietoa käytetään verkkosivuston kehittämiseen.

NimiTarjoajaTarkoitusVoimassaTyyppi
nmstatwww.hel.fiSiteimproven tilastointieväste kerää tietoa kävijän sivujen käytöstä.1000 päivää 
_pk_id.*www.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.141.89f6www.hel.fi-1 tunti 
_pk_id.*kartta.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*kartta.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
_pk_id.*palvelukartta.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*palvelukartta.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
_pk_id.*avustukset.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*avustukset.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
rnsbidreactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Paikallinen muisti
rnsbid_tsreactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Paikallinen muisti
rns_reaction_*reactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Paikallinen muisti
YSCyoutube.comYouTuben eväste mahdollistaa videoiden upottamisen sivustolle.IstuntoKolmas osapuoli
' + value: '

Tilastointievästeiden keräämää tietoa käytetään verkkosivuston kehittämiseen.

NimiTarjoajaTarkoitusVoimassaTyyppi
nmstatwww.hel.fiSiteimproven tilastointieväste kerää tietoa kävijän sivujen käytöstä.1000 päivää 
_pk_id.*www.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.141.89f6www.hel.fi-1 tunti 
_pk_id.*kartta.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*kartta.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
_pk_id.*palvelukartta.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*palvelukartta.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
_pk_id.*avustukset.hel.fiMatomo-tilastointijärjestelmän eväste.393 päivää 
_pk_ses.*avustukset.hel.fiMatomo-tilastointijärjestelmän eväste.1 tunti 
rnsbidreactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Tallennetaan käyttäjän laitteelle
rnsbid_tsreactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Tallennetaan käyttäjän laitteelle
rns_reaction_*reactandshare.comAskem-reaktionappien toimintaan liittyvä tietue.-Tallennetaan käyttäjän laitteelle
YSCyoutube.comYouTuben eväste mahdollistaa videoiden upottamisen sivustolle.IstuntoKolmas osapuoli
' format: full_html label: Tilastointi diff --git a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.chat.yml b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.chat.yml index 6464a1fe9..0a7860d4a 100644 --- a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.chat.yml +++ b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.chat.yml @@ -1,4 +1,4 @@ description: - value: '

Chattarna på webbplatsen www.hel.fi  fungerar med hjälp av funktionella chattkakor. Om du inleder en chatt godkänner du automatiskt de nödvändiga funktionella kakorna.  Då behövs inget separat samtycke till kakor. Funktionella chattkakor laddas endast ner på din enhet om du inleder en chatt.

NamnTjänsteleverantörCookie syfteGiltighetTyp
_genesys.widgets.*www.hel.fiAnvänds för att lagra data som behövs för chatten.session 
leijuke.*www.hel.fiAnvänds för att lagra data som behövs för chatten.session 
aiap-wbc-chat-app-button-statewww.hel.fiAnvänds för chattapplikationens funktionalitet. Lagrar inställningar och konfigurationsdata för chattapplikationens knapp.session 
aiap-chat-app-v1-statewww.hel.fiAnvänds för chattapplikationens funktionalitet. Lagrar inställningar och konfigurationsdata för chattapplikationen.session 
conversationTokenhttps://coh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudAnvänds för chattapplikationens funktionalitet. Lagrar konversationstoken för autentisering och åtkomst till dataändamål.sessionTredje part
CallGuide.languagewww.hel.fiACE Chat: Språket som används i ACE Web SDK härleds från webbläsarnas föredragna språkinställning och ACE Web SDK-inställningar.-Lokalt minne
CallGuide.config_services_*www.hel.fiACE Chatt: Konfigurera kundtjänstintegrationer på en webbsida. Minskar webbtrafiken när du läser in och navigerar på en sida.-Lokalt minne
*_CGWebSDK_windowGUIDwds.ace.teliacompany.comACE Chatt: Den unika identiteten för det här webbläsarfönstret. Används om webbläsaren har mer än ett öppet fönster för en webbplats.-Lokalt minne
*_CGWebSDK_videoShowerwds.ace.teliacompany.comACE Chatt: Endast ett fönster i taget kan visa video. Den här informationen spårar vilka av dem (om några).-Lokalt minne
*_CGWebSDK_videoClientswds.ace.teliacompany.comACE Chatt: En lista över alla fönster som sannolikt kommer att visa videon.-Lokalt minne
*_ACEChatState_ActiveClientwds.ace.teliacompany.comACE Chatt: En webbplats kan ha mer än en chattklient. Det här objektet spårar vilken kund den aktuella chatten tillhör.-Lokalt minne
*_chatEntrancewds.ace.teliacompany.comACE Chatt: Namnet på chattingången till systemet-Lokalt minne
*_chatUIDwds.ace.teliacompany.comACE Chatt: Chattsessions-ID vid kommunikation med ACE-Lokalt minne
humany-*www.hel.fiACE Chatt: Bevarar widgetstatus när sidan laddas om-Lokalt minne
ARRAffinity.hel.humany.netACE Chatt: Lastbalansering i backend-systemetSessionTredje part
ARRAffinitySameSite.hel.humany.netACE Chatt: Lastbalansering i backend-systemetSessionTredje part
' + value: '

Chattarna på webbplatsen www.hel.fi  fungerar med hjälp av funktionella chattkakor. Om du inleder en chatt godkänner du automatiskt de nödvändiga funktionella kakorna.  Då behövs inget separat samtycke till kakor. Funktionella chattkakor laddas endast ner på din enhet om du inleder en chatt.

NamnTjänsteleverantörCookie syfteGiltighetTyp
_genesys.widgets.*www.hel.fiAnvänds för att lagra data som behövs för chatten.session 
leijuke.*www.hel.fiAnvänds för att lagra data som behövs för chatten.session 
aiap-wbc-chat-app-button-statewww.hel.fiAnvänds för chattapplikationens funktionalitet. Lagrar inställningar och konfigurationsdata för chattapplikationens knapp.session 
aiap-chat-app-v1-statewww.hel.fiAnvänds för chattapplikationens funktionalitet. Lagrar inställningar och konfigurationsdata för chattapplikationen.session 
conversationTokenhttps://coh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudAnvänds för chattapplikationens funktionalitet. Lagrar konversationstoken för autentisering och åtkomst till dataändamål.sessionTredje part
CallGuide.languagewww.hel.fiACE Chat: Språket som används i ACE Web SDK härleds från webbläsarnas föredragna språkinställning och ACE Web SDK-inställningar.-Sparas på användarens enhet
CallGuide.config_services_*www.hel.fiACE Chatt: Konfigurera kundtjänstintegrationer på en webbsida. Minskar webbtrafiken när du läser in och navigerar på en sida.-Sparas på användarens enhet
*_CGWebSDK_windowGUIDwds.ace.teliacompany.comACE Chatt: Den unika identiteten för det här webbläsarfönstret. Används om webbläsaren har mer än ett öppet fönster för en webbplats.-Sparas på användarens enhet
*_CGWebSDK_videoShowerwds.ace.teliacompany.comACE Chatt: Endast ett fönster i taget kan visa video. Den här informationen spårar vilka av dem (om några).-Sparas på användarens enhet
*_CGWebSDK_videoClientswds.ace.teliacompany.comACE Chatt: En lista över alla fönster som sannolikt kommer att visa videon.-Sparas på användarens enhet
*_ACEChatState_ActiveClientwds.ace.teliacompany.comACE Chatt: En webbplats kan ha mer än en chattklient. Det här objektet spårar vilken kund den aktuella chatten tillhör.-Sparas på användarens enhet
*_chatEntrancewds.ace.teliacompany.comACE Chatt: Namnet på chattingången till systemet-Sparas på användarens enhet
*_chatUIDwds.ace.teliacompany.comACE Chatt: Chattsessions-ID vid kommunikation med ACE-Sparas på användarens enhet
humany-*www.hel.fiACE Chatt: Bevarar widgetstatus när sidan laddas om-Sparas på användarens enhet
ARRAffinity.hel.humany.netACE Chatt: Lastbalansering i backend-systemetSessionTredje part
ARRAffinitySameSite.hel.humany.netACE Chatt: Lastbalansering i backend-systemetSessionTredje part
' format: full_html label: 'Funktionella chattkakor' diff --git a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.essential.yml b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.essential.yml index d86d19346..b5435a8a0 100644 --- a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.essential.yml +++ b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.essential.yml @@ -1,4 +1,4 @@ description: - value: '

Nödvändiga cookies hjälper till att göra webbplatsen användbar genom att tillåta grundläggande funktioner som att navigera på sidan och använda de skyddade områdena på webbplatsen. Webbplatsen fungerar inte korrekt utan dessa cookies och kräver inte samtycke.

NamnTjänsteleverantörCookie syfteGiltighetTyp
cookiehubcookiehub.comCookie möjliggör hantering av cookies på www.hel.fi webbplatsen.365 dagar 
cookie-agreedwww.hel.fiCookie möjliggör hantering av cookies på webbplatsen.100 dagar 
cookie-agreed-versionwww.hel.fiAnvänds för att lagra information om versionen av cookies samtycke som användaren har godkänt.100 dagar 
cookie-agreed-categorieswww.hel.fiAnvänds för att lagra information om vilka cookie -kategorier användaren har godkänt.100 dagar 
cookie-agreedavustukset.hel.fiCookie möjliggör hantering av cookies på webbplatsen.100 dagar 
cookie-agreed-versionavustukset.hel.fiAnvänds för att lagra information om versionen av cookies samtycke som användaren har godkänt.100 dagar 
cookie-agreed-categoriesavustukset.hel.fiAnvänds för att lagra information om vilka cookie -kategorier användaren har godkänt.100 dagar 
SSESS*www.hel.fiEn cookie relaterad till driften av innehållshanteringssystemet.23 dagar 
SSESS*avustukset.hel.fiEn cookie relaterad till driften av innehållshanteringssystemet.23 dagar 
AWSELBCORSsiteimproveanalytics.ioCookie är kopplad till funktionen för lastfördelning som styr begäran till en server med mindre belastning.sessionTredje part
mtm_cookie_consentkartta.hel.fiA technical cookie that stores information about how you responded to the notice in the cookie banner about the use of cookies.10950 dagar 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

Kakan är en obligatorisk kaka som gör det möjligt för besökaren att besöka webbplatsen.sessionTredje part
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudAnvänds för chattapplikationens funktionalitet. Dess värde används för att få tillgång till sessiondata på applikationens server.sessionTredje part
COOKIE_SUPPORThelsinkikanava.fiKakan möjliggör hanteringen av kakor på webbplatsen.365 dagarTredje part
GUEST_LANGUAGE_IDhelsinkikanava.fiDenna cookie genereras av Liferay, dess funktion är att lagra språkinställningarna.365 dagarTredje part
helfi-settingswww.hel.fiAnvänds av www.hel.fi Drupal för att lagra information om stängda meddelanden och accordions'' tillstånd.-Lokalt minne
Drupal.visitor.autologout_loginavustukset.hel.fiAnvänds av avustukset.hel.fi Drupal för att automatiskt logga ut användare efter en period av inaktivitet.365 dagar 
' + value: '

Nödvändiga cookies hjälper till att göra webbplatsen användbar genom att tillåta grundläggande funktioner som att navigera på sidan och använda de skyddade områdena på webbplatsen. Webbplatsen fungerar inte korrekt utan dessa cookies och kräver inte samtycke.

NamnTjänsteleverantörCookie syfteGiltighetTyp
cookiehubcookiehub.comCookie möjliggör hantering av cookies på www.hel.fi webbplatsen.365 dagar 
cookie-agreedwww.hel.fiCookie möjliggör hantering av cookies på webbplatsen.100 dagar 
cookie-agreed-versionwww.hel.fiAnvänds för att lagra information om versionen av cookies samtycke som användaren har godkänt.100 dagar 
cookie-agreed-categorieswww.hel.fiAnvänds för att lagra information om vilka cookie -kategorier användaren har godkänt.100 dagar 
cookie-agreedavustukset.hel.fiCookie möjliggör hantering av cookies på webbplatsen.100 dagar 
cookie-agreed-versionavustukset.hel.fiAnvänds för att lagra information om versionen av cookies samtycke som användaren har godkänt.100 dagar 
cookie-agreed-categoriesavustukset.hel.fiAnvänds för att lagra information om vilka cookie -kategorier användaren har godkänt.100 dagar 
SSESS*www.hel.fiEn cookie relaterad till driften av innehållshanteringssystemet.23 dagar 
SSESS*avustukset.hel.fiEn cookie relaterad till driften av innehållshanteringssystemet.23 dagar 
AWSELBCORSsiteimproveanalytics.ioCookie är kopplad till funktionen för lastfördelning som styr begäran till en server med mindre belastning.sessionTredje part
mtm_cookie_consentkartta.hel.fiA technical cookie that stores information about how you responded to the notice in the cookie banner about the use of cookies.10950 dagar 
JSESSIONID

helsinkikanava.fi

coh-chat-app-prod.eu-de.mybluemix.net

Kakan är en obligatorisk kaka som gör det möjligt för besökaren att besöka webbplatsen.sessionTredje part
JSESSIONIDcoh-chat-app-prod.ow6i4n9pdzm.eu-de.codeengine.appdomain.cloudAnvänds för chattapplikationens funktionalitet. Dess värde används för att få tillgång till sessiondata på applikationens server.sessionTredje part
COOKIE_SUPPORThelsinkikanava.fiKakan möjliggör hanteringen av kakor på webbplatsen.365 dagarTredje part
GUEST_LANGUAGE_IDhelsinkikanava.fiDenna cookie genereras av Liferay, dess funktion är att lagra språkinställningarna.365 dagarTredje part
helfi-settingswww.hel.fiAnvänds av www.hel.fi Drupal för att lagra information om stängda meddelanden och accordions'' tillstånd.-Sparas på användarens enhet
Drupal.visitor.autologout_loginavustukset.hel.fiAnvänds av avustukset.hel.fi Drupal för att automatiskt logga ut användare efter en period av inaktivitet.365 dagar 
editoria11yResultCountwww.hel.fiSpårar tillgänglighetsproblem för den aktuella sidan när du är inloggad som redaktör på hel.fi.-Sparas på användarens enhet
Drupal.gin.sidebarExpanded.desktopwww.hel.fiLagrar om admin-sidopanelen är expanderad eller kollapsad på skrivbordet när du är inloggad som redaktör på hel.fi.-Sparas på användarens enhet
Drupal.gin.sidebarExpanded.mobilewww.hel.fiLagrar om admin-sidopanelen är expanderad eller kollapsad på mobil när du är inloggad som redaktör på hel.fi.-Sparas på användarens enhet
Drupal.gin.darkmodewww.hel.fiLagrar användarens mörkt läge-inställning i admin-temat när du är inloggad som redaktör på hel.fi.-Sparas på användarens enhet
Drupal.toolbar.subtrees.*www.hel.fiLagrar tillståndet för expanderade eller kollapsade undermenyer i Drupals admin-verktygsfält för en inloggad redaktör, vilket säkerställer konsekvens mellan sidladdningar.-Sparas på användarens enhet
Drupal.off-canvas.css.*www.hel.fiLagrar cachelagrad CKEditor CSS i localStorage för en inloggad redaktör, med en nyckel som använder en cache-brytande fråga för att säkerställa att den senaste CSS-filen laddas.-Sparas på användarens enhet
ed11ySeenwww.hel.fiSpårar vilka tillgänglighetsproblem en inloggad redaktör redan har sett för att undvika dubbla aviseringar.-Sparas på användarens enhet
editoria11yResultCountwww.hel.fiSpårar antalet tillgänglighetsproblem som hittats på specifika sidor för en inloggad redaktör, vilket hjälper till att övervaka och åtgärda dem.-Sparas på användarens enhet
Drupal.toolbar.toolbarStatewww.hel.fiLagrar tillståndet för admin-verktygsfältet för en inloggad redaktör, inklusive dess orientering, aktiva flik och expanderade tillstånd.SessionSparas på användarens enhet under sessionen
escapeAdminPathwww.hel.fiLagrar URL för att omdirigera en inloggad redaktör från admin-gränssnittet tillbaka till huvudsidan.-Sparas på användarens enhet under sessionen
' format: full_html label: 'Nödvändiga funktionella cookies' diff --git a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.statistics.yml b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.statistics.yml index 18a542a9c..8878024c4 100644 --- a/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.statistics.yml +++ b/conf/cmi/language/sv/eu_cookie_compliance.cookie_category.statistics.yml @@ -1,4 +1,4 @@ description: - value: '

De uppgifter statistikkakorna samlar in används för att utveckla webbplatsen.

NamnTjänsteleverantörCookie syfteGiltighetTyp
nmstatwww.hel.fiSiteimproves kaka samlar information om hur webbplatsen används.1000 dagar 
_pk_id.*www.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.141.89f6www.hel.fi-1 timme 
_pk_id.*kartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*kartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
_pk_id.*palvelukartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*palvelukartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
_pk_id.*avustukset.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*avustukset.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
rnsbidreactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Lokalt minne
rnsbid_tsreactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Lokalt minne
rns_reaction_*reactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Lokalt minne
YSCyoutube.comYouTubes kaka gör det möjligt att göra videor till en del av innehållet på webbplatsen.sessionTredje part

 

' + value: '

De uppgifter statistikkakorna samlar in används för att utveckla webbplatsen.

NamnTjänsteleverantörCookie syfteGiltighetTyp
nmstatwww.hel.fiSiteimproves kaka samlar information om hur webbplatsen används.1000 dagar 
_pk_id.*www.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.141.89f6www.hel.fi-1 timme 
_pk_id.*kartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*kartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
_pk_id.*palvelukartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*palvelukartta.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
_pk_id.*avustukset.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.393 dagar 
_pk_ses.*avustukset.hel.fiMatomo-statistiksystemets kaka samlar information om hur webbplatsen används.1 timme 
rnsbidreactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Sparas på användarens enhet
rnsbid_tsreactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Sparas på användarens enhet
rns_reaction_*reactandshare.com

En post relaterad till driften av reaktionsknappen 

Askem

.

-Sparas på användarens enhet
YSCyoutube.comYouTubes kaka gör det möjligt att göra videor till en del av innehållet på webbplatsen.sessionTredje part

 

' format: full_html label: Statistik From 2134a58ec6b9bebc9e08a65677089a486e2081b9 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:54:58 +0300 Subject: [PATCH 04/14] UHF-10631: Add HelfiRecommendations entity --- ...hdbt_subtheme_aipoweredrecommendations.yml | 0 .../config/schema/helfi_annif.schema.yml | 12 ++++ .../custom/helfi_annif/helfi_annif.info.yml | 2 +- .../custom/helfi_annif/helfi_annif.install | 10 +++ .../custom/helfi_annif/helfi_annif.module | 9 ++- .../src/Entity/SuggestedTopics.php | 71 +++++++++++++++++++ .../FieldType/ScoredEntityReferenceItem.php | 70 ++++++++++++++++++ .../Plugin/QueueWorker/KeywordQueueWorker.php | 3 +- .../src/SuggestedTopicsInterface.php | 13 ++++ 9 files changed, 185 insertions(+), 5 deletions(-) rename public/modules/custom/helfi_annif/config/{install/public/modules/custom/helfi_annif/config => }/optional/block.block.hdbt_subtheme_aipoweredrecommendations.yml (100%) create mode 100644 public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml create mode 100644 public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php create mode 100644 public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php create mode 100644 public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php diff --git a/public/modules/custom/helfi_annif/config/install/public/modules/custom/helfi_annif/config/optional/block.block.hdbt_subtheme_aipoweredrecommendations.yml b/public/modules/custom/helfi_annif/config/optional/block.block.hdbt_subtheme_aipoweredrecommendations.yml similarity index 100% rename from public/modules/custom/helfi_annif/config/install/public/modules/custom/helfi_annif/config/optional/block.block.hdbt_subtheme_aipoweredrecommendations.yml rename to public/modules/custom/helfi_annif/config/optional/block.block.hdbt_subtheme_aipoweredrecommendations.yml diff --git a/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml b/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml new file mode 100644 index 000000000..134c5fb98 --- /dev/null +++ b/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml @@ -0,0 +1,12 @@ +field.value.helfi_annif_suggestion: + type: mapping + label: Default value + mapping: + target_id: + type: string + label: 'Value' + target_uuid: + type: uuid + score: + type: label + label: Score diff --git a/public/modules/custom/helfi_annif/helfi_annif.info.yml b/public/modules/custom/helfi_annif/helfi_annif.info.yml index 2f167d9e1..a9357aac1 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.info.yml +++ b/public/modules/custom/helfi_annif/helfi_annif.info.yml @@ -7,9 +7,9 @@ dependencies: - drupal:text - drupal:language - helfi_api_base:helfi_api_base - - helfi_etusivu:helfi_etusivu - readonly_field_widget:readonly_field_widget - drupal:field + - helfi_etusivu:helfi_etusivu - helfi_node_news_item:helfi_node_news_item - helfi_node_news_article:helfi_node_news_article 'interface translation project': helfi_annif diff --git a/public/modules/custom/helfi_annif/helfi_annif.install b/public/modules/custom/helfi_annif/helfi_annif.install index e1db7267c..0beb83b6d 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.install +++ b/public/modules/custom/helfi_annif/helfi_annif.install @@ -50,3 +50,13 @@ function helfi_annif_update_9001(): void { ); } } + +/** + * Creates the database table for the HelfiRecommendations entity. + */ +function helfi_annif_update_9002(): void { + $definition = \Drupal::entityTypeManager()->getDefinition('suggested_topics'); + + \Drupal::entityDefinitionUpdateManager() + ->installEntityType($definition); +} diff --git a/public/modules/custom/helfi_annif/helfi_annif.module b/public/modules/custom/helfi_annif/helfi_annif.module index 8571ca590..b7fb2855c 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.module +++ b/public/modules/custom/helfi_annif/helfi_annif.module @@ -34,7 +34,7 @@ function helfi_annif_theme() : array { /** * Implements hook_themes_installed(). */ -function helfi_annif_themes_installed($theme_list) { +function helfi_annif_themes_installed($theme_list): void { /** @var Drupal\helfi_platform_config\Helper\BlockInstaller $block_installer */ $block_installer = Drupal::service('helfi_platform_config.helper.block_installer'); @@ -74,7 +74,7 @@ function helfi_annif_themes_installed($theme_list) { * @return array[] * The block configurations. */ -function helfi_annif_get_block_configurations(string $theme) { +function helfi_annif_get_block_configurations(string $theme): array { return [ 'hdbt_subtheme_hdbt_subtheme_aipoweredrecommendations' => [ 'block' => [ @@ -172,7 +172,10 @@ function helfi_annif_entity_bundle_field_info_alter(&$fields, EntityTypeInterfac */ function helfi_annif_entity_field_storage_info(EntityTypeInterface $entity_type): array { if ($entity_type->id() === 'node') { - return array_merge(helfi_annif_bundle_fields($entity_type->id(), 'news_item'), helfi_annif_bundle_fields($entity_type->id(), 'news_article')); + return array_merge( + helfi_annif_bundle_fields($entity_type->id(), 'news_item'), + helfi_annif_bundle_fields($entity_type->id(), 'news_article') + ); } return []; } diff --git a/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php new file mode 100644 index 000000000..89229db8d --- /dev/null +++ b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php @@ -0,0 +1,71 @@ +setLabel(new TranslatableMarkup('Status')) + ->setDefaultValue(FALSE) + ->setSetting('on_label', 'Enabled') + ->setDisplayOptions('view', [ + 'type' => 'boolean', + 'label' => 'above', + 'weight' => 0, + 'settings' => [ + 'format' => 'enabled-disabled', + ], + ]) + ->setDisplayConfigurable('view', TRUE); + + $fields['keywords'] = BaseFieldDefinition::create('scored_entity_reference') + ->setLabel(new TranslatableMarkup('Keywords')) + ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) + ->setSetting('target_type', 'taxonomy_term') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'entity_reference_label', + 'weight' => 15, + ]) + ->setDisplayConfigurable('view', TRUE); + + return $fields; + } + +} diff --git a/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php new file mode 100644 index 000000000..fbdecbad6 --- /dev/null +++ b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php @@ -0,0 +1,70 @@ +setLabel(new TranslatableMarkup('Score')) + ->setRequired(TRUE); + + return $properties; + } + + /** + * {@inheritdoc} + */ + public static function schema(FieldStorageDefinitionInterface $field_definition): array { + $schema = parent::schema($field_definition); + + // Score is a decimal number between 0 and 1. + $schema['columns']['score'] = [ + 'type' => 'float', + ]; + + return $schema; + } + + /** + * {@inheritdoc} + */ + public static function generateSampleValue(FieldDefinitionInterface $field_definition): array { + $values = parent::generateSampleValue($field_definition); + + $values['score'] = mt_rand() / mt_getrandmax(); + + return $values; + } + +} diff --git a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php index 0f722e710..ec7b1a7ed 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php +++ b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php @@ -8,6 +8,7 @@ use Drupal\Core\Entity\TranslatableInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Queue\QueueWorkerBase; +use Drupal\Core\Utility\Error; use Drupal\helfi_annif\Client\KeywordClientException; use Drupal\helfi_annif\KeywordManager; use Psr\Log\LoggerInterface; @@ -94,7 +95,7 @@ public function processItem(mixed $data) : void { $this->keywordManager->processEntity($entity, overwriteExisting: $overwrite); } catch (KeywordClientException $exception) { - $this->logger->error($exception->getMessage()); + Error::logException($this->logger, $exception); } } diff --git a/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php b/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php new file mode 100644 index 000000000..4288a4165 --- /dev/null +++ b/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php @@ -0,0 +1,13 @@ + Date: Tue, 24 Sep 2024 08:55:04 +0300 Subject: [PATCH 05/14] UHF-10631: Rename KeywordClient to ApiClient --- .../custom/helfi_annif/helfi_annif.services.yml | 2 +- .../Client/{KeywordClient.php => ApiClient.php} | 10 +++++----- ...lientException.php => ApiClientException.php} | 2 +- .../src/Drush/Commands/AnnifCommands.php | 4 ++-- .../custom/helfi_annif/src/KeywordManager.php | 13 +++++++------ .../Plugin/QueueWorker/KeywordQueueWorker.php | 4 ++-- .../tests/src/Kernel/KeywordManagerTest.php | 4 ++-- .../{KeywordClientTest.php => ApiClientTest.php} | 16 ++++++++-------- .../tests/src/Unit/KeywordManagerTest.php | 4 ++-- 9 files changed, 30 insertions(+), 29 deletions(-) rename public/modules/custom/helfi_annif/src/Client/{KeywordClient.php => ApiClient.php} (94%) rename public/modules/custom/helfi_annif/src/Client/{KeywordClientException.php => ApiClientException.php} (71%) rename public/modules/custom/helfi_annif/tests/src/Unit/Client/{KeywordClientTest.php => ApiClientTest.php} (90%) diff --git a/public/modules/custom/helfi_annif/helfi_annif.services.yml b/public/modules/custom/helfi_annif/helfi_annif.services.yml index 1c6c410c2..07cdb1b83 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.services.yml +++ b/public/modules/custom/helfi_annif/helfi_annif.services.yml @@ -11,7 +11,7 @@ services: Drupal\helfi_annif\RecommendationManager: ~ - Drupal\helfi_annif\Client\KeywordClient: ~ + Drupal\helfi_annif\Client\ApiClient : ~ Drupal\helfi_annif\TextConverter\TextConverterManager: tags: diff --git a/public/modules/custom/helfi_annif/src/Client/KeywordClient.php b/public/modules/custom/helfi_annif/src/Client/ApiClient.php similarity index 94% rename from public/modules/custom/helfi_annif/src/Client/KeywordClient.php rename to public/modules/custom/helfi_annif/src/Client/ApiClient.php index 31fa23d77..1d4cf5d32 100644 --- a/public/modules/custom/helfi_annif/src/Client/KeywordClient.php +++ b/public/modules/custom/helfi_annif/src/Client/ApiClient.php @@ -13,7 +13,7 @@ /** * The keyword generator. */ -final class KeywordClient { +final class ApiClient { /** * Maximum batch size. @@ -62,7 +62,7 @@ private function getDefaultOptions() : array { * @return \Drupal\helfi_annif\Client\Keyword[]|null * Keywords or NULL if unsupported entity. * - * @throws KeywordClientException + * @throws \Drupal\helfi_annif\Client\ApiClientException * If keyword generator returns an error. */ public function suggest(EntityInterface $entity) : ?array { @@ -93,7 +93,7 @@ public function suggest(EntityInterface $entity) : ?array { return $this->mapResults(Utils::jsonDecode($response->getBody()->getContents())); } catch (GuzzleException $e) { - throw new KeywordClientException($e->getMessage(), previous: $e); + throw new ApiClientException($e->getMessage(), previous: $e); } } @@ -107,7 +107,7 @@ public function suggest(EntityInterface $entity) : ?array { * Batch suggestion results keyed by input array keys. The * results array might not contain all input entities. * - * @throws KeywordClientException + * @throws \Drupal\helfi_annif\Client\ApiClientException * If keyword generator returns an error. */ public function suggestBatch(array $entities) : array { @@ -171,7 +171,7 @@ function ($carry, $item) { ); } catch (GuzzleException $e) { - throw new KeywordClientException($e->getMessage(), previous: $e); + throw new ApiClientException($e->getMessage(), previous: $e); } } diff --git a/public/modules/custom/helfi_annif/src/Client/KeywordClientException.php b/public/modules/custom/helfi_annif/src/Client/ApiClientException.php similarity index 71% rename from public/modules/custom/helfi_annif/src/Client/KeywordClientException.php rename to public/modules/custom/helfi_annif/src/Client/ApiClientException.php index e4096f7f5..44af97939 100644 --- a/public/modules/custom/helfi_annif/src/Client/KeywordClientException.php +++ b/public/modules/custom/helfi_annif/src/Client/ApiClientException.php @@ -7,5 +7,5 @@ /** * Exceptions for keyword generator errors. */ -class KeywordClientException extends \Exception { +class ApiClientException extends \Exception { } diff --git a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php index ce1729ff8..cb29124ce 100644 --- a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php +++ b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\TranslatableInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Utility\Error; -use Drupal\helfi_annif\Client\KeywordClient; +use Drupal\helfi_annif\Client\ApiClient; use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\TextConverter\TextConverterManager; use Drush\Attributes\Argument; @@ -79,7 +79,7 @@ public function process( string $bundle, array $options = [ 'overwrite' => FALSE, - 'batch-size' => KeywordClient::MAX_BATCH_SIZE, + 'batch-size' => ApiClient::MAX_BATCH_SIZE, ], ) : int { $definition = $this->entityTypeManager->getDefinition($entityType); diff --git a/public/modules/custom/helfi_annif/src/KeywordManager.php b/public/modules/custom/helfi_annif/src/KeywordManager.php index 8c1bc7e8f..447330f3e 100644 --- a/public/modules/custom/helfi_annif/src/KeywordManager.php +++ b/public/modules/custom/helfi_annif/src/KeywordManager.php @@ -9,8 +9,8 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\TranslatableInterface; use Drupal\Core\Queue\QueueFactory; +use Drupal\helfi_annif\Client\ApiClient; use Drupal\helfi_annif\Client\Keyword; -use Drupal\helfi_annif\Client\KeywordClient; /** * The keyword manager. @@ -39,7 +39,7 @@ final class KeywordManager { * * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * The entity type manager. - * @param \Drupal\helfi_annif\Client\KeywordClient $keywordGenerator + * @param \Drupal\helfi_annif\Client\ApiClient $keywordGenerator * The keyword generator. * @param \Drupal\Core\Queue\QueueFactory $queueFactory * The queue factory. @@ -49,7 +49,7 @@ final class KeywordManager { */ public function __construct( private readonly EntityTypeManagerInterface $entityTypeManager, - private readonly KeywordClient $keywordGenerator, + private readonly ApiClient $keywordGenerator, private readonly QueueFactory $queueFactory, ) { $this->termStorage = $this->entityTypeManager->getStorage('taxonomy_term'); @@ -115,7 +115,8 @@ public function queueEntity(RecommendableInterface $entity, bool $overwriteExist * @param bool $overwriteExisting * Overwrites existing keywords when set to TRUE. * - * @throws \Drupal\helfi_annif\Client\KeywordClientException + * @throws \Drupal\helfi_annif\Client\ApiClientException + * @throws \Drupal\Core\Entity\EntityStorageException */ public function processEntity(RecommendableInterface $entity, bool $overwriteExisting = FALSE) : void { if (!$entity->hasField(self::KEYWORD_FIELD)) { @@ -143,7 +144,7 @@ public function processEntity(RecommendableInterface $entity, bool $overwriteExi * @param bool $overwriteExisting * Overwrites existing keywords when set to TRUE. * - * @throws \Drupal\helfi_annif\Client\KeywordClientException + * @throws \Drupal\helfi_annif\Client\ApiClientException * @throws \Drupal\Core\Entity\EntityStorageException */ public function processEntities(array $entities, bool $overwriteExisting = FALSE) : void { @@ -201,7 +202,7 @@ private function prepareBatches(array $entities, bool $overwriteExisting) : \Gen } foreach ($buckets as $bucket) { - foreach (array_chunk($bucket, KeywordClient::MAX_BATCH_SIZE, preserve_keys: TRUE) as $batch) { + foreach (array_chunk($bucket, ApiClient::MAX_BATCH_SIZE, preserve_keys: TRUE) as $batch) { yield $batch; } } diff --git a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php index ec7b1a7ed..0f23e216b 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php +++ b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php @@ -9,7 +9,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Queue\QueueWorkerBase; use Drupal\Core\Utility\Error; -use Drupal\helfi_annif\Client\KeywordClientException; +use Drupal\helfi_annif\Client\ApiClientException; use Drupal\helfi_annif\KeywordManager; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -94,7 +94,7 @@ public function processItem(mixed $data) : void { try { $this->keywordManager->processEntity($entity, overwriteExisting: $overwrite); } - catch (KeywordClientException $exception) { + catch (ApiClientException $exception) { Error::logException($this->logger, $exception); } } diff --git a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php index a1870858e..5e2454f93 100644 --- a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php @@ -7,7 +7,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Queue\QueueFactory; use Drupal\Core\Queue\QueueInterface; -use Drupal\helfi_annif\Client\KeywordClient; +use Drupal\helfi_annif\Client\ApiClient; use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\TextConverter\TextConverterInterface; use Drupal\KernelTests\KernelTestBase; @@ -116,7 +116,7 @@ private function getSut( ): KeywordManager { $textConverterManager = $this->getTextConverterManager($textConverter); - $client = new KeywordClient( + $client = new ApiClient( $this->createMockHttpClient($responses), $textConverterManager, ); diff --git a/public/modules/custom/helfi_annif/tests/src/Unit/Client/KeywordClientTest.php b/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php similarity index 90% rename from public/modules/custom/helfi_annif/tests/src/Unit/Client/KeywordClientTest.php rename to public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php index 75bac35ed..e20374084 100644 --- a/public/modules/custom/helfi_annif/tests/src/Unit/Client/KeywordClientTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php @@ -4,9 +4,9 @@ namespace Drupal\Tests\helfi_annif\Unit\Client; +use Drupal\helfi_annif\Client\ApiClient; +use Drupal\helfi_annif\Client\ApiClientException; use Drupal\helfi_annif\Client\Keyword; -use Drupal\helfi_annif\Client\KeywordClient; -use Drupal\helfi_annif\Client\KeywordClientException; use Drupal\helfi_annif\TextConverter\TextConverterInterface; use Drupal\Tests\helfi_annif\Traits\AnnifApiTestTrait; use Drupal\Tests\UnitTestCase; @@ -78,7 +78,7 @@ public function testHttpError(): void { new RequestException('Bad request', new Request('GET', 'test')), ]); - $this->expectException(KeywordClientException::class); + $this->expectException(ApiClientException::class); $sut->suggest($entity); } @@ -92,7 +92,7 @@ public function testHttpErrorBatch(): void { new RequestException('Bad request', new Request('GET', 'test')), ]); - $this->expectException(KeywordClientException::class); + $this->expectException(ApiClientException::class); $sut->suggestBatch([$entity]); } @@ -150,7 +150,7 @@ public function testValidBatchRequest(): void { ]); $textConverterManager = $this->getTextConverterManager(); - $sut = new KeywordClient($httpClient, $textConverterManager); + $sut = new ApiClient($httpClient, $textConverterManager); $batch = $sut->suggestBatch($entities); @@ -175,7 +175,7 @@ public function testValidBatchRequest(): void { public function testMaxBatchSize() : void { $sut = $this->getSut([]); - $batch = array_fill(0, KeywordClient::MAX_BATCH_SIZE + 1, $this->mockEntity()); + $batch = array_fill(0, ApiClient::MAX_BATCH_SIZE + 1, $this->mockEntity()); $this->expectException(\InvalidArgumentException::class); $sut->suggestBatch($batch); @@ -184,11 +184,11 @@ public function testMaxBatchSize() : void { /** * Gets service under test. */ - private function getSut(array $responses, ?TextConverterInterface $textConverter = NULL): KeywordClient { + private function getSut(array $responses, ?TextConverterInterface $textConverter = NULL): ApiClient { $client = $this->createMockHttpClient($responses); $textConverterManager = $this->getTextConverterManager($textConverter); - return new KeywordClient($client, $textConverterManager); + return new ApiClient($client, $textConverterManager); } } diff --git a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php index 9451b5015..7d192eeae 100644 --- a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php @@ -8,7 +8,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Queue\QueueFactory; use Drupal\Core\Queue\QueueInterface; -use Drupal\helfi_annif\Client\KeywordClient; +use Drupal\helfi_annif\Client\ApiClient; use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\TextConverter\TextConverterInterface; use Drupal\Tests\helfi_annif\Traits\AnnifApiTestTrait; @@ -101,7 +101,7 @@ private function getSut( ): KeywordManager { $textConverterManager = $this->getTextConverterManager($textConverter); - $client = new KeywordClient( + $client = new ApiClient( $this->createMockHttpClient($responses), $textConverterManager, ); From 034bb97bc7ec4947e446e4d3fcfa1e9d8b05a8e0 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:55:05 +0300 Subject: [PATCH 06/14] UHF-10631: Rename KeywordManager to TopicsManager --- .../modules/custom/helfi_annif/helfi_annif.module | 14 +++++++------- .../custom/helfi_annif/helfi_annif.services.yml | 2 +- .../src/Drush/Commands/AnnifCommands.php | 8 ++++---- .../src/Plugin/QueueWorker/KeywordQueueWorker.php | 10 +++++----- .../src/{KeywordManager.php => TopicsManager.php} | 4 ++-- .../tests/src/Kernel/KeywordManagerTest.php | 8 ++++---- .../tests/src/Traits/AnnifApiTestTrait.php | 6 +++--- .../tests/src/Unit/KeywordManagerTest.php | 12 ++++++------ 8 files changed, 32 insertions(+), 32 deletions(-) rename public/modules/custom/helfi_annif/src/{KeywordManager.php => TopicsManager.php} (99%) diff --git a/public/modules/custom/helfi_annif/helfi_annif.module b/public/modules/custom/helfi_annif/helfi_annif.module index b7fb2855c..d5eb328e8 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.module +++ b/public/modules/custom/helfi_annif/helfi_annif.module @@ -12,9 +12,9 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\entity\BundleFieldDefinition; -use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\RecommendableInterface; use Drupal\helfi_annif\TextConverter\Document; +use Drupal\helfi_annif\TopicsManager; /** * Implements hook_theme(). @@ -132,9 +132,9 @@ function helfi_annif_get_block_configurations(string $theme): array { */ function helfi_annif_entity_insert(EntityInterface $entity) : void { if ($entity instanceof RecommendableInterface) { - /** @var \Drupal\helfi_annif\KeywordManager $keywordManager */ - $keywordManager = \Drupal::service(KeywordManager::class); - $keywordManager->queueEntity($entity, TRUE); + /** @var \Drupal\helfi_annif\TopicsManager $topicsManager */ + $topicsManager = \Drupal::service(TopicsManager::class); + $topicsManager->queueEntity($entity, TRUE); } } @@ -143,9 +143,9 @@ function helfi_annif_entity_insert(EntityInterface $entity) : void { */ function helfi_annif_entity_update(EntityInterface $entity) : void { if ($entity instanceof RecommendableInterface) { - /** @var \Drupal\helfi_annif\KeywordManager $keywordManager */ - $keywordManager = \Drupal::service(KeywordManager::class); - $keywordManager->queueEntity($entity, TRUE); + /** @var \Drupal\helfi_annif\TopicsManager $topicsManager */ + $topicsManager = \Drupal::service(TopicsManager::class); + $topicsManager->queueEntity($entity, TRUE); } } diff --git a/public/modules/custom/helfi_annif/helfi_annif.services.yml b/public/modules/custom/helfi_annif/helfi_annif.services.yml index 07cdb1b83..2aafb08cb 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.services.yml +++ b/public/modules/custom/helfi_annif/helfi_annif.services.yml @@ -7,7 +7,7 @@ services: parent: logger.channel_base arguments: ['helfi_annif'] - Drupal\helfi_annif\KeywordManager: ~ + Drupal\helfi_annif\TopicsManager: ~ Drupal\helfi_annif\RecommendationManager: ~ diff --git a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php index cb29124ce..a4592811e 100644 --- a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php +++ b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php @@ -14,7 +14,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Utility\Error; use Drupal\helfi_annif\Client\ApiClient; -use Drupal\helfi_annif\KeywordManager; +use Drupal\helfi_annif\TopicsManager; use Drupal\helfi_annif\TextConverter\TextConverterManager; use Drush\Attributes\Argument; use Drush\Attributes\Command; @@ -41,14 +41,14 @@ final class AnnifCommands extends DrushCommands { * The entity type manager. * @param \Drupal\helfi_annif\TextConverter\TextConverterManager $textConverter * The text converter. - * @param \Drupal\helfi_annif\KeywordManager $keywordManager + * @param \Drupal\helfi_annif\TopicsManager $topicsManager * The keyword generator. */ public function __construct( private readonly Connection $connection, private readonly EntityTypeManagerInterface $entityTypeManager, private readonly TextConverterManager $textConverter, - private readonly KeywordManager $keywordManager, + private readonly TopicsManager $topicsManager, ) { parent::__construct(); } @@ -136,7 +136,7 @@ public function processBatch( ->getStorage($entityType) ->loadMultiple($slice); - $this->keywordManager->processEntities($entities, $overwrite); + $this->topicsManager->processEntities($entities, $overwrite); $context['sandbox']['from'] = $to; $context['message'] = $this->t("@total entities remaining", [ diff --git a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php index 0f23e216b..371564a03 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php +++ b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php @@ -10,7 +10,7 @@ use Drupal\Core\Queue\QueueWorkerBase; use Drupal\Core\Utility\Error; use Drupal\helfi_annif\Client\ApiClientException; -use Drupal\helfi_annif\KeywordManager; +use Drupal\helfi_annif\TopicsManager; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -28,9 +28,9 @@ final class KeywordQueueWorker extends QueueWorkerBase implements ContainerFacto /** * The keyword manager. * - * @var \Drupal\helfi_annif\KeywordManager + * @var \Drupal\helfi_annif\TopicsManager */ - private KeywordManager $keywordManager; + private TopicsManager $topicsManager; /** * The entity repository. @@ -55,7 +55,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, ); - $instance->keywordManager = $container->get(KeywordManager::class); + $instance->topicsManager = $container->get(TopicsManager::class); $instance->entityTypeManager = $container->get(EntityTypeManagerInterface::class); $instance->logger = $container->get('logger.channel.helfi_annif'); @@ -92,7 +92,7 @@ public function processItem(mixed $data) : void { } try { - $this->keywordManager->processEntity($entity, overwriteExisting: $overwrite); + $this->topicsManager->processEntity($entity, overwriteExisting: $overwrite); } catch (ApiClientException $exception) { Error::logException($this->logger, $exception); diff --git a/public/modules/custom/helfi_annif/src/KeywordManager.php b/public/modules/custom/helfi_annif/src/TopicsManager.php similarity index 99% rename from public/modules/custom/helfi_annif/src/KeywordManager.php rename to public/modules/custom/helfi_annif/src/TopicsManager.php index 447330f3e..300e8e6e8 100644 --- a/public/modules/custom/helfi_annif/src/KeywordManager.php +++ b/public/modules/custom/helfi_annif/src/TopicsManager.php @@ -13,9 +13,9 @@ use Drupal\helfi_annif\Client\Keyword; /** - * The keyword manager. + * The topic manager. */ -final class KeywordManager { +final class TopicsManager { public const KEYWORD_FIELD = 'annif_keywords'; public const KEYWORD_VID = 'annif_keywords'; diff --git a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php index 5e2454f93..247fe00fd 100644 --- a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php @@ -8,8 +8,8 @@ use Drupal\Core\Queue\QueueFactory; use Drupal\Core\Queue\QueueInterface; use Drupal\helfi_annif\Client\ApiClient; -use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\TextConverter\TextConverterInterface; +use Drupal\helfi_annif\TopicsManager; use Drupal\KernelTests\KernelTestBase; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\helfi_annif\Traits\AnnifApiTestTrait; @@ -17,7 +17,7 @@ use Prophecy\Argument; /** - * Tests KeywordManager. + * Tests TopicsManager. * * @group helfi_annif */ @@ -113,7 +113,7 @@ private function getSut( array $responses = [], ?TextConverterInterface $textConverter = NULL, ?QueueInterface $queue = NULL, - ): KeywordManager { + ): TopicsManager { $textConverterManager = $this->getTextConverterManager($textConverter); $client = new ApiClient( @@ -134,7 +134,7 @@ private function getSut( ->get(Argument::any()) ->willReturn($queue); - return new KeywordManager( + return new TopicsManager( $entityTypeManager, $client, $queueFactory->reveal(), diff --git a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php index afb31583e..9e174e35e 100644 --- a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php +++ b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php @@ -6,10 +6,10 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Language\LanguageInterface; -use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\RecommendableInterface; use Drupal\helfi_annif\TextConverter\TextConverterInterface; use Drupal\helfi_annif\TextConverter\TextConverterManager; +use Drupal\helfi_annif\TopicsManager; use Drupal\Tests\helfi_api_base\Traits\ApiTestTrait; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -81,10 +81,10 @@ protected function mockEntity(string $langcode = 'fi', bool|NULL $hasKeywords = $field->isEmpty()->willReturn(!$hasKeywords); $entity - ->hasField(Argument::exact(KeywordManager::KEYWORD_FIELD)) + ->hasField(Argument::exact(TopicsManager::KEYWORD_FIELD)) ->willReturn($hasKeywords !== NULL); $entity - ->get(Argument::exact(KeywordManager::KEYWORD_FIELD)) + ->get(Argument::exact(TopicsManager::KEYWORD_FIELD)) ->willReturn($field->reveal()); if (is_bool($shouldSave)) { diff --git a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php index 7d192eeae..65c6a76a7 100644 --- a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php @@ -9,14 +9,14 @@ use Drupal\Core\Queue\QueueFactory; use Drupal\Core\Queue\QueueInterface; use Drupal\helfi_annif\Client\ApiClient; -use Drupal\helfi_annif\KeywordManager; use Drupal\helfi_annif\TextConverter\TextConverterInterface; +use Drupal\helfi_annif\TopicsManager; use Drupal\Tests\helfi_annif\Traits\AnnifApiTestTrait; use Drupal\Tests\UnitTestCase; use Prophecy\Argument; /** - * Tests KeywordManager. + * Tests TopicsManager. * * @group helfi_annif */ @@ -28,7 +28,7 @@ class KeywordManagerTest extends UnitTestCase { * Tests entities without keyword field. */ public function testUnsupportedEntity(): void { - // hasField(KeywordManager::KEYWORD_FIELD) for entity is FALSE. + // hasField(TopicsManager::KEYWORD_FIELD) for entity is FALSE. $entity = $this->mockEntity(hasKeywords: NULL, hasKeywordField: FALSE); $queue = $this->prophesize(QueueInterface::class); $queue @@ -67,7 +67,7 @@ public function testKeywordOverwriting(): void { * Tests entities with unsupported langcode. */ public function testUnsupportedLangcode(): void { - // hasField(KeywordManager::KEYWORD_FIELD) for entity is FALSE. + // hasField(TopicsManager::KEYWORD_FIELD) for entity is FALSE. $entity = $this->mockEntity(langcode: 'xzz', shouldSave: FALSE); $sut = $this->getSut(); @@ -98,7 +98,7 @@ private function getSut( ?TextConverterInterface $textConverter = NULL, ?EntityStorageInterface $termStorage = NULL, ?QueueInterface $queue = NULL, - ): KeywordManager { + ): TopicsManager { $textConverterManager = $this->getTextConverterManager($textConverter); $client = new ApiClient( @@ -128,7 +128,7 @@ private function getSut( ->get(Argument::any()) ->willReturn($queue); - return new KeywordManager( + return new TopicsManager( $entityTypeManager->reveal(), $client, $queueFactory->reveal(), From d97d60f3e0a2f83095a9651ab2103fff6b28671a Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:55:07 +0300 Subject: [PATCH 07/14] UHF-10631: Rename KeywordQueueWorker to QueueWorker --- .../QueueWorker/{KeywordQueueWorker.php => QueueWorker.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename public/modules/custom/helfi_annif/src/Plugin/QueueWorker/{KeywordQueueWorker.php => QueueWorker.php} (95%) diff --git a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/QueueWorker.php similarity index 95% rename from public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php rename to public/modules/custom/helfi_annif/src/Plugin/QueueWorker/QueueWorker.php index 371564a03..5b1e9f9ba 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/KeywordQueueWorker.php +++ b/public/modules/custom/helfi_annif/src/Plugin/QueueWorker/QueueWorker.php @@ -23,7 +23,7 @@ * cron = {"time" = 60} * ) */ -final class KeywordQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface { +final class QueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface { /** * The keyword manager. From bffb4d436c73ed2e2085cb6f47d55e083f393eab Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:55:09 +0300 Subject: [PATCH 08/14] UHF-10631: Ensure content is not saved when keywords are generated --- .../config/schema/helfi_annif.schema.yml | 8 + .../custom/helfi_annif/helfi_annif.info.yml | 1 + .../custom/helfi_annif/helfi_annif.install | 36 +++ .../custom/helfi_annif/helfi_annif.module | 30 +-- .../helfi_annif/helfi_annif.services.yml | 2 + .../src/Drush/Commands/AnnifCommands.php | 66 ++++- .../src/Entity/SuggestedTopics.php | 7 + .../SuggestedTopicsReferenceItem.php | 78 ++++++ .../SuggestedTopicsReferenceWidget.php | 67 +++++ .../helfi_annif/src/RecommendableBase.php | 40 +-- .../src/RecommendableInterface.php | 8 +- .../helfi_annif/src/ReferenceUpdater.php | 243 ++++++++++++++++++ .../src/SuggestedTopicsInterface.php | 9 + .../custom/helfi_annif/src/TopicsManager.php | 35 +-- .../tests/src/Traits/AnnifApiTestTrait.php | 4 +- 15 files changed, 580 insertions(+), 54 deletions(-) create mode 100644 public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/SuggestedTopicsReferenceItem.php create mode 100644 public/modules/custom/helfi_annif/src/Plugin/Field/FieldWidget/SuggestedTopicsReferenceWidget.php create mode 100644 public/modules/custom/helfi_annif/src/ReferenceUpdater.php diff --git a/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml b/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml index 134c5fb98..aa3367c7c 100644 --- a/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml +++ b/public/modules/custom/helfi_annif/config/schema/helfi_annif.schema.yml @@ -10,3 +10,11 @@ field.value.helfi_annif_suggestion: score: type: label label: Score + +field.value.suggested_topics_reference: + type: mapping + label: Default value + mapping: + value: + type: label + label: Value diff --git a/public/modules/custom/helfi_annif/helfi_annif.info.yml b/public/modules/custom/helfi_annif/helfi_annif.info.yml index a9357aac1..e6e7404fc 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.info.yml +++ b/public/modules/custom/helfi_annif/helfi_annif.info.yml @@ -9,6 +9,7 @@ dependencies: - helfi_api_base:helfi_api_base - readonly_field_widget:readonly_field_widget - drupal:field + # TODO: remove dependency to etusivu. - helfi_etusivu:helfi_etusivu - helfi_node_news_item:helfi_node_news_item - helfi_node_news_article:helfi_node_news_article diff --git a/public/modules/custom/helfi_annif/helfi_annif.install b/public/modules/custom/helfi_annif/helfi_annif.install index 0beb83b6d..bb7a041f5 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.install +++ b/public/modules/custom/helfi_annif/helfi_annif.install @@ -60,3 +60,39 @@ function helfi_annif_update_9002(): void { \Drupal::entityDefinitionUpdateManager() ->installEntityType($definition); } + +/** + * Updates field storage definition for etusivu news entities. + */ +function helfi_annif_update_9003(): void { + $updates = [ + 'annif_suggested_topics' => [ + 'node' => [ + 'news_article', + 'news_item', + ], + ], + ]; + + $entity_field_manager = \Drupal::service('entity_field.manager'); + $update_manager = \Drupal::entityDefinitionUpdateManager(); + + foreach ($updates as $field => $entity_types) { + foreach ($entity_types as $entity_type_id => $bundles) { + foreach ($bundles as $bundle) { + $field_definitions = $entity_field_manager->getFieldDefinitions($entity_type_id, $bundle); + + $update_manager->installFieldStorageDefinition( + $field, + $entity_type_id, + 'helfi_annif', + $field_definitions[$field], + ); + } + } + } + + \Drupal::messenger()->addMessage('Run drush helfi:annif-fix-references'); + + // @todo remove obsolete field annif_keywords in a future update hook. +} diff --git a/public/modules/custom/helfi_annif/helfi_annif.module b/public/modules/custom/helfi_annif/helfi_annif.module index d5eb328e8..dcdee1e6e 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.module +++ b/public/modules/custom/helfi_annif/helfi_annif.module @@ -159,6 +159,7 @@ function helfi_annif_entity_bundle_field_info_alter(&$fields, EntityTypeInterfac } } + // @todo remove dependency to etusivu config. $recommendable_node_bundles = ['news_item', 'news_article']; if ($entityType->id() == 'node' && in_array($bundle, $recommendable_node_bundles)) { foreach (helfi_annif_bundle_fields($entityType->id(), $bundle) as $name => $field) { @@ -211,30 +212,27 @@ function helfi_annif_bundle_fields(string $entity_type_id, string $bundle): arra ->setDisplayConfigurable('view', TRUE); } - $keywordfieldId = 'annif_keywords'; - $keywordfieldName = new TranslatableMarkup('Automatically selected news categories', [], ['context' => 'annif']); + $fields['annif_suggested_topics'] = BundleFieldDefinition::create('suggested_topics_reference') + ->setName('annif_suggested_topics') + ->setLabel(new TranslatableMarkup('Automatically selected news categories', [], ['context' => 'annif'])) + ->setTargetEntityTypeId($entity_type_id) + ->setTargetBundle($bundle) + ->setReadonly(TRUE) + ->setTranslatable(FALSE); + // @todo remove this. + $keywordfieldId = 'annif_keywords'; $fields[$keywordfieldId] = BundleFieldDefinition::create('entity_reference') ->setName($keywordfieldId) - ->setLabel($keywordfieldName) - ->setSettings(['target_type' => 'taxonomy_term']) ->setTargetEntityTypeId($entity_type_id) ->setTargetBundle($bundle) - ->setDisplayOptions('form', - [ - 'type' => 'readonly_field_widget', - 'third_party_settings' => [], - 'settings' => - [ - 'formatter_type' => 'entity_reference_label', - ], - ] - ) + ->setDisplayOptions('form', ['type' => 'hidden']) + ->setDisplayOptions('view', ['type' => 'hidden']) ->setReadonly(TRUE) ->setTranslatable(FALSE) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + ->setDisplayConfigurable('form', FALSE) + ->setDisplayConfigurable('view', FALSE); return $fields; } diff --git a/public/modules/custom/helfi_annif/helfi_annif.services.yml b/public/modules/custom/helfi_annif/helfi_annif.services.yml index 2aafb08cb..f9a122bcc 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.services.yml +++ b/public/modules/custom/helfi_annif/helfi_annif.services.yml @@ -9,6 +9,8 @@ services: Drupal\helfi_annif\TopicsManager: ~ + Drupal\helfi_annif\ReferenceUpdater: ~ + Drupal\helfi_annif\RecommendationManager: ~ Drupal\helfi_annif\Client\ApiClient : ~ diff --git a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php index a4592811e..21069b8e3 100644 --- a/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php +++ b/public/modules/custom/helfi_annif/src/Drush/Commands/AnnifCommands.php @@ -10,12 +10,14 @@ use Drupal\Core\Database\Connection; use Drupal\Core\DependencyInjection\DependencySerializationTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\TranslatableInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Utility\Error; use Drupal\helfi_annif\Client\ApiClient; -use Drupal\helfi_annif\TopicsManager; +use Drupal\helfi_annif\ReferenceUpdater; use Drupal\helfi_annif\TextConverter\TextConverterManager; +use Drupal\helfi_annif\TopicsManager; use Drush\Attributes\Argument; use Drush\Attributes\Command; use Drush\Attributes\Option; @@ -43,12 +45,15 @@ final class AnnifCommands extends DrushCommands { * The text converter. * @param \Drupal\helfi_annif\TopicsManager $topicsManager * The keyword generator. + * @param \Drupal\helfi_annif\ReferenceUpdater $referenceManager + * The reference manager. */ public function __construct( private readonly Connection $connection, private readonly EntityTypeManagerInterface $entityTypeManager, private readonly TextConverterManager $textConverter, private readonly TopicsManager $topicsManager, + private readonly ReferenceUpdater $referenceManager, ) { parent::__construct(); } @@ -276,4 +281,63 @@ public function batchVisibilityFieldsDefaultValues(array $entityIds, &$context,) } } + /** + * Fix entity references in a batch. + * + * @param array $entityIds + * Ids of entities to update. + * @param array $context + * The context. + */ + public function batchFixEntityReferences(array $entityIds, array &$context): void { + if (!isset($context['sandbox']['from'])) { + $context['sandbox']['from'] = 0; + } + + $batchSize = 50; + $from = $context['sandbox']['from']; + $to = min($from + $batchSize, count($entityIds)); + $slice = array_slice($entityIds, $from, $to - $from); + + try { + foreach ($slice as $item) { + ['entity_type' => $entity_type, 'id' => $id] = $item; + + $entity = $this->entityTypeManager + ->getStorage($entity_type) + ->load($id); + + assert($entity instanceof FieldableEntityInterface); + $this->referenceManager->updateEntityReferenceFields($entity); + } + + $context['sandbox']['from'] = $to; + $context['message'] = sprintf("%d entities remaining", count($entityIds) - $to); + $context['finished'] = $to >= count($entityIds); + } + catch (\Exception $e) { + $context['message'] = sprintf('An error occurred during processing: %s', $e->getMessage()); + $context['finished'] = 1; + } + } + + /** + * Set new fields' default values. + */ + #[Command(name: 'helfi:annif-fix-references')] + public function fixEntityReferences(): int { + $entities = $this->referenceManager->getReferencesWithoutTarget(); + + $batch = (new BatchBuilder()) + ->addOperation([$this, 'batchFixEntityReferences'], [ + $entities, + ]); + + batch_set($batch->toArray()); + + drush_backend_batch_process(); + + return DrushCommands::EXIT_SUCCESS; + } + } diff --git a/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php index 89229db8d..d03e2dd6f 100644 --- a/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php +++ b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php @@ -68,4 +68,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a return $fields; } + /** + * {@inheritDoc} + */ + public function hasKeywords(): bool { + return $this->keywords->isEmpty(); + } + } diff --git a/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/SuggestedTopicsReferenceItem.php b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/SuggestedTopicsReferenceItem.php new file mode 100644 index 000000000..cf27bfc5b --- /dev/null +++ b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/SuggestedTopicsReferenceItem.php @@ -0,0 +1,78 @@ + 'suggested_topics', + ] + parent::defaultStorageSettings(); + } + + /** + * {@inheritdoc} + */ + public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data): array { + $elements = parent::storageSettingsForm($form, $form_state, $has_data); + + $elements['target_type']['#access'] = FALSE; + + return $elements; + } + + /** + * {@inheritdoc} + */ + public function fieldSettingsForm(array $form, FormStateInterface $form_state): array { + $form = parent::fieldSettingsForm($form, $form_state); + + $form['handler']['#access'] = FALSE; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function preSave() { + if ($this->hasNewEntity()) { + $this->entity->save(); + } + + parent::preSave(); + } + + /** + * {@inheritdoc} + */ + public function delete(): void { + if ($this->entity) { + $this->entity->delete(); + } + } + +} diff --git a/public/modules/custom/helfi_annif/src/Plugin/Field/FieldWidget/SuggestedTopicsReferenceWidget.php b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldWidget/SuggestedTopicsReferenceWidget.php new file mode 100644 index 000000000..6b864d480 --- /dev/null +++ b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldWidget/SuggestedTopicsReferenceWidget.php @@ -0,0 +1,67 @@ +target_id) && $items[$delta]->entity; + + /** @var \Drupal\helfi_annif\Entity\SuggestedTopics $entity */ + $entity = $hasTargetEntity ? $items[$delta]->entity : SuggestedTopics::create([]); + + $element['entity'] = [ + '#type' => 'value', + '#value' => $entity, + ]; + + if ($hasTargetEntity) { + $keywords = []; + foreach ($entity->referencedEntities() as $keyword) { + $keywords[] = $keyword->label(); + } + + $element['keywords'] = [ + '#theme' => 'item_list', + '#items' => $keywords, + ]; + + $element['target_id'] = [ + '#type' => 'value', + '#default_value' => $items[$delta]->target_id, + ]; + } + + return $element; + } + +} diff --git a/public/modules/custom/helfi_annif/src/RecommendableBase.php b/public/modules/custom/helfi_annif/src/RecommendableBase.php index 85ee62871..9640cce31 100644 --- a/public/modules/custom/helfi_annif/src/RecommendableBase.php +++ b/public/modules/custom/helfi_annif/src/RecommendableBase.php @@ -4,7 +4,7 @@ namespace Drupal\helfi_annif; -use Drupal\Core\Cache\Cache; +use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\node\Entity\Node; /** @@ -12,15 +12,13 @@ */ abstract class RecommendableBase extends Node implements RecommendableInterface { - protected const string KEYWORDFIELD = 'annif_keywords'; - - protected const string SHOW_RECOMMENDATIONS_BLOCK = 'show_annif_block'; + protected const SHOW_RECOMMENDATIONS_BLOCK = 'show_annif_block'; /** * {@inheritDoc} */ public function isRecommendableContent(): bool { - return !$this->get(self::KEYWORDFIELD)->isEmpty(); + return !$this->get(TopicsManager::TOPICS_FIELD)->isEmpty(); } /** @@ -42,14 +40,16 @@ public function showRecommendationsBlock(): bool { * {@inheritDoc} */ public function hasKeywords(): bool { - return !$this->get(self::KEYWORDFIELD)->isEmpty(); - } + $field = $this->getTopicsField(); - /** - * {@inheritDoc} - */ - public function getKeywordFieldName(): string { - return self::KEYWORDFIELD; + foreach ($field->referencedEntities() as $topics) { + assert($topics instanceof SuggestedTopicsInterface); + if ($topics->hasKeywords()) { + return TRUE; + } + } + + return FALSE; } /** @@ -57,7 +57,7 @@ public function getKeywordFieldName(): string { */ public function getCacheTagsToInvalidate(): array { $parentCacheTags = parent::getCacheTagsToInvalidate(); - if (!$this->hasField(self::getKeywordFieldName())) { + if (!$this->hasField(TopicsManager::TOPICS_FIELD)) { return $parentCacheTags; } @@ -72,13 +72,23 @@ public function getCacheTagsToInvalidate(): array { * Array of cache tags for keywords. */ protected function getKeywordsCacheTags(): array { - $terms = $this->get(self::getKeywordFieldName())->referencedEntities(); + $field = $this->getTopicsField(); $tags = array_map( fn ($term) => $term->getCacheTags(), - $terms + $field->referencedEntities() ); return array_merge(...$tags); } + /** + * {@inheritDoc} + */ + public function getTopicsField(): EntityReferenceFieldItemListInterface { + $field = $this->get(TopicsManager::TOPICS_FIELD); + assert($field instanceof EntityReferenceFieldItemListInterface); + + return $field; + } + } diff --git a/public/modules/custom/helfi_annif/src/RecommendableInterface.php b/public/modules/custom/helfi_annif/src/RecommendableInterface.php index cd2588486..aa4d1135e 100644 --- a/public/modules/custom/helfi_annif/src/RecommendableInterface.php +++ b/public/modules/custom/helfi_annif/src/RecommendableInterface.php @@ -45,11 +45,11 @@ public function showRecommendationsBlock(): bool; public function hasKeywords(): bool; /** - * Get keyword field name. + * Get keyword field. * - * @return string - * Name of the field which holds the keywords. + * @return \Drupal\Core\Field\EntityReferenceFieldItemListInterface + * Field which holds the keywords. */ - public function getKeywordFieldName(): string; + public function getTopicsField(): EntityReferenceFieldItemListInterface; } diff --git a/public/modules/custom/helfi_annif/src/ReferenceUpdater.php b/public/modules/custom/helfi_annif/src/ReferenceUpdater.php new file mode 100644 index 000000000..e62b15ba0 --- /dev/null +++ b/public/modules/custom/helfi_annif/src/ReferenceUpdater.php @@ -0,0 +1,243 @@ +getAllReferenceFields(); + + foreach ($fieldNames as $entityType => $bundles) { + foreach ($bundles as $bundle => $fields) { + $ids = $this->entitiesWithNonexistentFields($entityType, $bundle, $fields); + $result = $this->mergeEntityIds($result, $entityType, $ids); + } + } + + return $result; + } + + /** + * Returns the names of reference fields of the given entity data. + * + * @param string $entityType + * The entity type. + * @param string $bundle + * The bundle. + * + * @return array + * The field names. Empty array if this entity does not contain + * suggested_topics_reference fields. + */ + public function getReferenceFields(string $entityType, string $bundle): array { + return $this->getAllReferenceFields()[$entityType][$bundle] ?? []; + } + + /** + * Returns a map of reference fields per entity and bundle. + * + * @return array + * Array of annif_suggested_topics fields. Structure: + * - entity type: array keyed by bundle. + * - bundle: array of field names. + */ + private function getAllReferenceFields(): array { + if (!is_null($this->referenceFields)) { + return $this->referenceFields; + } + + // EntityFieldManagerInterface::getFieldMapByFieldType() does not work here. + // See: https://www.drupal.org/project/drupal/issues/3045509. + $this->referenceFields = []; + foreach ($this->entityTypeManager->getDefinitions() as $entityTypeId => $entityType) { + if (!$entityType->entityClassImplements(FieldableEntityInterface::class)) { + continue; + } + + foreach ($this->entityTypeBundleInfo->getBundleInfo($entityTypeId) as $bundle => $bundleInfo) { + foreach ($this->entityFieldManager->getFieldDefinitions($entityTypeId, $bundle) as $fieldDefinition) { + if ($fieldDefinition->getType() === 'suggested_topics_reference') { + $this->referenceFields[$entityTypeId][$bundle][] = $fieldDefinition->getName(); + } + } + } + } + + return $this->referenceFields; + } + + /** + * Returns IDs of entities where one or more fields have no value. + * + * @param string $entityType + * The entity type. + * @param string $bundle + * The entity bundle. + * @param array $fields + * The entity reference field names to check. + * + * @return array + * Array of entity IDs. Empty array if none were found. + * + * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException + * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException + */ + private function entitiesWithNonexistentFields(string $entityType, string $bundle, array $fields): array { + $query = $this->entityTypeManager + ->getStorage($entityType) + ->getQuery() + ->accessCheck(FALSE); + + $bundleKey = $this->entityTypeManager + ->getDefinition($entityType) + ->getKey('bundle'); + if ($bundleKey) { + $query->condition($bundleKey, $bundle); + } + + $orGroup = $query->orConditionGroup(); + foreach ($fields as $field) { + $orGroup->notExists($field); + } + $query->condition($orGroup); + + return $query->execute(); + } + + /** + * Merges entity IDs of multiple entity types. + * + * @param array $data + * The existing entity IDs. + * @param string $entityType + * The entity type of the IDs. + * @param array $ids + * The IDs to merge. + * + * @return array + * The merged data. Associative array keyed by "entity_type:entity_id". + * Values a structured array: + * - entity_type: The entity type. + * - id: The entity ID. + */ + private function mergeEntityIds(array $data, string $entityType, array $ids): array { + foreach ($ids as $id) { + $data["$entityType:$id"] = [ + 'entity_type' => $entityType, + 'id' => $id, + ]; + } + + return $data; + } + + /** + * Adds missing annif entities to reference fields. + * + * @param \Drupal\Core\Entity\FieldableEntityInterface $entity + * The entity to update. + * + * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException + * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException + * @throws \Drupal\Core\Entity\EntityStorageException + * @throws \Drupal\Core\TypedData\Exception\ReadOnlyException + */ + public function updateEntityReferenceFields(FieldableEntityInterface $entity): void { + $entityIsUpdated = FALSE; + $fieldNames = $this->getReferenceFields($entity->getEntityTypeId(), $entity->bundle()); + + foreach ($fieldNames as $fieldName) { + $referenceField = $entity->get($fieldName); + if ($referenceField->isEmpty()) { + $topicsEntity = $this->entityTypeManager + ->getStorage('suggested_topics') + ->create([]); + + $referenceField->setValue($topicsEntity); + + assert($topicsEntity instanceof SuggestedTopics); + $this->copyLegacyData($entity, $topicsEntity); + + $entityIsUpdated = TRUE; + } + } + + if ($entityIsUpdated) { + $entity->save(); + } + } + + /** + * Copy values from legacy field to the new entity. + * + * @todo remove this once the legacy field is deleted. + */ + private function copyLegacyData(FieldableEntityInterface $entity, SuggestedTopicsInterface $topics): void { + if (!$entity->hasField('annif_keywords')) { + return; + } + + $keywords = $entity->get('annif_keywords')->getValue(); + $count = count($keywords); + $keywords = array_map(fn (array $item, int $index) => $item + [ + // The legacy data does not have scores. However, the keywords + // are sorted by score, so this maps the index to range [0, 0.5]. + 'score' => ($count - $index) / $count / 2, + ], $keywords, array_keys($keywords)); + + $topics->set('keywords', $keywords); + } + +} diff --git a/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php b/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php index 4288a4165..15d8ce02b 100644 --- a/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php +++ b/public/modules/custom/helfi_annif/src/SuggestedTopicsInterface.php @@ -10,4 +10,13 @@ * Provides an interface defining a suggestted topics entity type. */ interface SuggestedTopicsInterface extends ContentEntityInterface { + + /** + * Check if the entity has keywords. + * + * @return bool + * Entity has keywords. + */ + public function hasKeywords(): bool; + } diff --git a/public/modules/custom/helfi_annif/src/TopicsManager.php b/public/modules/custom/helfi_annif/src/TopicsManager.php index 300e8e6e8..4db6ad2a5 100644 --- a/public/modules/custom/helfi_annif/src/TopicsManager.php +++ b/public/modules/custom/helfi_annif/src/TopicsManager.php @@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\TranslatableInterface; +use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Queue\QueueFactory; use Drupal\helfi_annif\Client\ApiClient; use Drupal\helfi_annif\Client\Keyword; @@ -17,7 +18,7 @@ */ final class TopicsManager { - public const KEYWORD_FIELD = 'annif_keywords'; + public const TOPICS_FIELD = 'annif_suggested_topics'; public const KEYWORD_VID = 'annif_keywords'; /** @@ -88,7 +89,7 @@ private function isEntityProcessed(EntityInterface $entity) : bool { */ public function queueEntity(RecommendableInterface $entity, bool $overwriteExisting = FALSE) : void { if ( - !$entity->hasField(self::KEYWORD_FIELD) || + !$entity->hasField(self::TOPICS_FIELD) || // Skip if entity was processed in this request. $this->isEntityProcessed($entity) || // Skip if entity already has keywords. @@ -111,7 +112,7 @@ public function queueEntity(RecommendableInterface $entity, bool $overwriteExist * Generates keywords for single entity. * * @param \Drupal\helfi_annif\RecommendableInterface $entity - * The entities. + * The entity. * @param bool $overwriteExisting * Overwrites existing keywords when set to TRUE. * @@ -119,7 +120,7 @@ public function queueEntity(RecommendableInterface $entity, bool $overwriteExist * @throws \Drupal\Core\Entity\EntityStorageException */ public function processEntity(RecommendableInterface $entity, bool $overwriteExisting = FALSE) : void { - if (!$entity->hasField(self::KEYWORD_FIELD)) { + if (!$entity->hasField(self::TOPICS_FIELD)) { return; } @@ -181,8 +182,7 @@ private function prepareBatches(array $entities, bool $overwriteExisting) : \Gen foreach ($entities as $key => $entity) { assert($entity instanceof RecommendableInterface); - - if (!$entity->hasField(self::KEYWORD_FIELD)) { + if (!$entity->hasField(self::TOPICS_FIELD)) { continue; } @@ -219,19 +219,22 @@ private function prepareBatches(array $entities, bool $overwriteExisting) : \Gen * @throws \Drupal\Core\Entity\EntityStorageException */ private function saveKeywords(RecommendableInterface $entity, array $keywords) : void { - $terms = []; - - foreach ($keywords as $keyword) { - $terms[] = $this->getTerm($keyword, $entity->language()->getId()); + $values = array_map(fn($keyword) => [ + 'entity' => $this->getTerm($keyword, $entity->language()->getId()), + 'score' => $keyword->score, + ], $keywords); + + $field = $entity->get(self::TOPICS_FIELD); + assert($field instanceof EntityReferenceFieldItemListInterface); + foreach ($field->referencedEntities() as $topicsEntity) { + /** @var \Drupal\helfi_annif\SuggestedTopicsInterface $topicsEntity */ + $topicsEntity->set('keywords', $values); + $topicsEntity->save(); } - $entity->set($entity->getKeywordFieldName(), $terms); - - // This needs to be before ->save() so - // processedItems is set for update hooks. + // Mark as processed so the same entity is bombarding the + // API if it is queued multiple times for some reason. $this->processedItems[$this->getEntityKey($entity)] = TRUE; - - $entity->save(); } /** diff --git a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php index 9e174e35e..a4e60bf0d 100644 --- a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php +++ b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php @@ -81,10 +81,10 @@ protected function mockEntity(string $langcode = 'fi', bool|NULL $hasKeywords = $field->isEmpty()->willReturn(!$hasKeywords); $entity - ->hasField(Argument::exact(TopicsManager::KEYWORD_FIELD)) + ->hasField(Argument::exact(TopicsManager::TOPICS_FIELD)) ->willReturn($hasKeywords !== NULL); $entity - ->get(Argument::exact(TopicsManager::KEYWORD_FIELD)) + ->get(Argument::exact(TopicsManager::TOPICS_FIELD)) ->willReturn($field->reveal()); if (is_bool($shouldSave)) { From 5f3e609b132995321c1b103ef6e1dde5f3e82734 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:55:13 +0300 Subject: [PATCH 09/14] UHF-10631: Fix recommendations block and tests --- .../custom/helfi_annif/helfi_annif.module | 6 +-- .../src/Entity/SuggestedTopics.php | 31 +++++++++++- .../src/Plugin/Block/RecommendationsBlock.php | 33 ++++++++----- .../helfi_annif/src/RecommendableBase.php | 33 +------------ .../src/RecommendableInterface.php | 8 --- .../helfi_annif/src/RecommendationManager.php | 49 ++++++++++--------- .../tests/src/Kernel/KeywordManagerTest.php | 1 + .../tests/src/Traits/AnnifApiTestTrait.php | 31 ++++++------ .../tests/src/Unit/Client/ApiClientTest.php | 2 +- .../tests/src/Unit/KeywordManagerTest.php | 2 +- 10 files changed, 99 insertions(+), 97 deletions(-) diff --git a/public/modules/custom/helfi_annif/helfi_annif.module b/public/modules/custom/helfi_annif/helfi_annif.module index dcdee1e6e..d577f9ed8 100644 --- a/public/modules/custom/helfi_annif/helfi_annif.module +++ b/public/modules/custom/helfi_annif/helfi_annif.module @@ -218,7 +218,9 @@ function helfi_annif_bundle_fields(string $entity_type_id, string $bundle): arra ->setTargetEntityTypeId($entity_type_id) ->setTargetBundle($bundle) ->setReadonly(TRUE) - ->setTranslatable(FALSE); + ->setTranslatable(FALSE) + ->setDisplayOptions('form', ['type' => 'suggested_topics_reference']) + ->setDisplayConfigurable('form', TRUE); // @todo remove this. $keywordfieldId = 'annif_keywords'; @@ -226,8 +228,6 @@ function helfi_annif_bundle_fields(string $entity_type_id, string $bundle): arra ->setName($keywordfieldId) ->setTargetEntityTypeId($entity_type_id) ->setTargetBundle($bundle) - ->setDisplayOptions('form', ['type' => 'hidden']) - ->setDisplayOptions('view', ['type' => 'hidden']) ->setReadonly(TRUE) ->setTranslatable(FALSE) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) diff --git a/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php index d03e2dd6f..c48bc0043 100644 --- a/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php +++ b/public/modules/custom/helfi_annif/src/Entity/SuggestedTopics.php @@ -4,9 +4,11 @@ namespace Drupal\helfi_annif\Entity; +use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; +use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\helfi_annif\SuggestedTopicsInterface; @@ -32,7 +34,7 @@ * }, * ) */ -final class SuggestedTopics extends ContentEntityBase implements SuggestedTopicsInterface { +class SuggestedTopics extends ContentEntityBase implements SuggestedTopicsInterface { /** * {@inheritdoc} @@ -72,7 +74,32 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a * {@inheritDoc} */ public function hasKeywords(): bool { - return $this->keywords->isEmpty(); + return $this->get('keywords')->isEmpty(); + } + + /** + * {@inheritDoc} + */ + public function getCacheTagsToInvalidate(): array { + return Cache::mergeTags(parent::getCacheTagsToInvalidate(), ...$this->getKeywordsCacheTags()); + } + + /** + * Get the cache tags for all the keywords. + * + * @return array + * Array of cache tags for keywords. + */ + protected function getKeywordsCacheTags(): array { + $tags = []; + + $field = $this->get('keywords'); + assert($field instanceof EntityReferenceFieldItemListInterface); + foreach ($field->referencedEntities() as $keyword) { + $tags[] = $keyword->getCacheTags(); + } + + return $tags; } } diff --git a/public/modules/custom/helfi_annif/src/Plugin/Block/RecommendationsBlock.php b/public/modules/custom/helfi_annif/src/Plugin/Block/RecommendationsBlock.php index 3db2e5803..ece770d27 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/Block/RecommendationsBlock.php +++ b/public/modules/custom/helfi_annif/src/Plugin/Block/RecommendationsBlock.php @@ -9,13 +9,16 @@ use Drupal\Core\Block\BlockBase; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\Context\EntityContextDefinition; use Drupal\Core\Plugin\ContextAwarePluginInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\Core\Utility\Error; use Drupal\helfi_annif\RecommendableInterface; use Drupal\helfi_annif\RecommendationManager; +use Drupal\helfi_annif\TopicsManager; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -50,8 +53,8 @@ public function __construct( /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : static { - return new static($configuration, $plugin_id, $plugin_definition, + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : self { + return new self($configuration, $plugin_id, $plugin_definition, $container->get(RecommendationManager::class), $container->get('entity_type.manager'), $container->get('current_user'), @@ -67,7 +70,7 @@ public function build() : array { $node = $this->getContextValue('node'); } catch (ContextException $exception) { - $this->logger->error($exception->getMessage()); + Error::logException($this->logger, $exception); return []; } @@ -90,14 +93,17 @@ public function build() : array { return $response; } - $nodes = []; + $view_builder = $this->entityTypeManager->getViewBuilder('node'); + // We want to render the recommendation results as nodes // so that all fields are correctly preprocessed. + $nodes = []; foreach ($recommendations as $recommendation) { - $view_builder = $this->entityTypeManager->getViewBuilder('node'); $nodes[] = $view_builder->view($recommendation, 'teaser'); } + $response['#rows'] = $nodes; + return $response; } @@ -107,7 +113,7 @@ public function build() : array { public function getCacheContexts(): array { return Cache::mergeContexts( parent::getCacheContexts(), - ['languages:language_content', 'user.roles:anonymous'], + ['languages:language_content', 'user.roles:anonymous', 'url.path'], ); } @@ -117,10 +123,15 @@ public function getCacheContexts(): array { public function getCacheTags(): array { $node = $this->getContextValue('node'); - return Cache::mergeTags( - parent::getCacheTags(), - $node->getCacheTags(), - ); + $topics = $node->get(TopicsManager::TOPICS_FIELD); + assert($topics instanceof EntityReferenceFieldItemListInterface); + + $tags = []; + foreach ($topics->referencedEntities() as $entity) { + $tags[] = $entity->getCacheTags(); + } + + return Cache::mergeTags(parent::getCacheTags(), ...$tags); } /** @@ -138,7 +149,7 @@ private function getRecommendations(RecommendableInterface $node): array { ->getRecommendations($node, 3, 'fi'); } catch (\Exception $exception) { - $this->logger->error($exception->getMessage()); + Error::logException($this->logger, $exception); return []; } return $recommendations; diff --git a/public/modules/custom/helfi_annif/src/RecommendableBase.php b/public/modules/custom/helfi_annif/src/RecommendableBase.php index 9640cce31..d507957b8 100644 --- a/public/modules/custom/helfi_annif/src/RecommendableBase.php +++ b/public/modules/custom/helfi_annif/src/RecommendableBase.php @@ -53,38 +53,9 @@ public function hasKeywords(): bool { } /** - * {@inheritDoc} - */ - public function getCacheTagsToInvalidate(): array { - $parentCacheTags = parent::getCacheTagsToInvalidate(); - if (!$this->hasField(TopicsManager::TOPICS_FIELD)) { - return $parentCacheTags; - } - - $keywordsCacheTags = $this->getKeywordsCacheTags(); - return Cache::mergeTags($parentCacheTags, $keywordsCacheTags); - } - - /** - * Get the cache tags for all the keywords. - * - * @return array - * Array of cache tags for keywords. - */ - protected function getKeywordsCacheTags(): array { - $field = $this->getTopicsField(); - - $tags = array_map( - fn ($term) => $term->getCacheTags(), - $field->referencedEntities() - ); - return array_merge(...$tags); - } - - /** - * {@inheritDoc} + * Get topics field. */ - public function getTopicsField(): EntityReferenceFieldItemListInterface { + private function getTopicsField(): EntityReferenceFieldItemListInterface { $field = $this->get(TopicsManager::TOPICS_FIELD); assert($field instanceof EntityReferenceFieldItemListInterface); diff --git a/public/modules/custom/helfi_annif/src/RecommendableInterface.php b/public/modules/custom/helfi_annif/src/RecommendableInterface.php index aa4d1135e..d900c8b90 100644 --- a/public/modules/custom/helfi_annif/src/RecommendableInterface.php +++ b/public/modules/custom/helfi_annif/src/RecommendableInterface.php @@ -44,12 +44,4 @@ public function showRecommendationsBlock(): bool; */ public function hasKeywords(): bool; - /** - * Get keyword field. - * - * @return \Drupal\Core\Field\EntityReferenceFieldItemListInterface - * Field which holds the keywords. - */ - public function getTopicsField(): EntityReferenceFieldItemListInterface; - } diff --git a/public/modules/custom/helfi_annif/src/RecommendationManager.php b/public/modules/custom/helfi_annif/src/RecommendationManager.php index f23accded..8e0310886 100644 --- a/public/modules/custom/helfi_annif/src/RecommendationManager.php +++ b/public/modules/custom/helfi_annif/src/RecommendationManager.php @@ -89,34 +89,37 @@ public function getRecommendations(EntityInterface $entity, int $limit = 3, stri * @return array * Database query result. */ - private function executeQuery(EntityInterface $entity, string $target_langcode, string $destination_langcode, int $limit) { + private function executeQuery(EntityInterface $entity, string $target_langcode, string $destination_langcode, int $limit): array { $query = " - select + SELECT n.nid, count(n.nid) as relevancy, nfd.created, nfd.status - from node as n - left join node__annif_keywords as annif on n.nid = annif.entity_id - left join node_field_data as nfd on nfd.nid = n.nid - where annif.annif_keywords_target_id in - (select annif_keywords_target_id - from node__annif_keywords - where entity_id = :nid and - langcode = :target_langcode) - and n.nid not in - (select distinct restriction.entity_id - from node__in_recommendations as restriction - where restriction.in_recommendations_value = 0) - and nfd.status = 1 - and n.langcode = :target_langcode - and annif.langcode = :target_langcode - and nfd.langcode = :destination_langcode - and n.nid != :nid - and nfd.created > :timestamp - group by n.nid - order by count(n.nid) DESC - limit {$limit}; + FROM node as n + INNER JOIN node__annif_suggested_topics as reference ON n.nid = reference.entity_id + INNER JOIN suggested_topics as topics ON topics.id = reference.annif_suggested_topics_target_id + INNER JOIN suggested_topics__keywords as keywords ON topics.id = keywords.entity_id + INNER JOIN node_field_data as nfd ON nfd.nid = n.nid AND nfd.langcode = :destination_langcode + WHERE + nfd.status = 1 + -- Select rows that have keywords in common with current entity. + AND keywords.keywords_target_id IN + (SELECT keywords_target_id + FROM suggested_topics__keywords stk + INNER JOIN node__annif_suggested_topics AS node ON stk.entity_id = node.annif_suggested_topics_target_id + WHERE node.entity_id = :nid) + -- Filter out entities that should be hidden from recommendations. + AND n.nid NOT IN + (SELECT DISTINCT restriction.entity_id + FROM node__in_recommendations as restriction + WHERE restriction.in_recommendations_value = 0) + AND n.langcode = :target_langcode + AND n.nid != :nid + AND nfd.created > :timestamp + GROUP BY n.nid + ORDER BY count(n.nid) DESC + LIMIT {$limit}; "; // Cannot add :limit as parameter here, diff --git a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php index 247fe00fd..308080779 100644 --- a/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Kernel/KeywordManagerTest.php @@ -46,6 +46,7 @@ public function setUp(): void { $entities = [ 'taxonomy_term', + 'suggested_topics', ]; foreach ($entities as $entity) { diff --git a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php index a4e60bf0d..2d2542139 100644 --- a/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php +++ b/public/modules/custom/helfi_annif/tests/src/Traits/AnnifApiTestTrait.php @@ -4,8 +4,9 @@ namespace Drupal\Tests\helfi_annif\Traits; -use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Language\LanguageInterface; +use Drupal\helfi_annif\Entity\SuggestedTopics; use Drupal\helfi_annif\RecommendableInterface; use Drupal\helfi_annif\TextConverter\TextConverterInterface; use Drupal\helfi_annif\TextConverter\TextConverterManager; @@ -52,10 +53,8 @@ protected function getFixture(string $name): string { * Value for keyword field ->isEmpty(), NULL for ->hasField() = FALSE. * @param bool|null $shouldSave * Bool if $entity->save() should be called, NULL for no opinion. - * @param bool $hasKeywordField - * Bool if entity should have keyword field. */ - protected function mockEntity(string $langcode = 'fi', bool|NULL $hasKeywords = FALSE, bool|NULL $shouldSave = NULL, $hasKeywordField = TRUE): RecommendableInterface { + protected function mockEntity(string $langcode = 'fi', bool|NULL $hasKeywords = FALSE, bool|NULL $shouldSave = NULL): RecommendableInterface { $language = $this->prophesize(LanguageInterface::class); $language ->getId() @@ -66,34 +65,32 @@ protected function mockEntity(string $langcode = 'fi', bool|NULL $hasKeywords = ->language() ->willReturn($language->reveal()); - $entity->hasField('annif_keywords')->willReturn($hasKeywordField); - - $entity->hasKeywords()->willReturn($hasKeywords ?? FALSE); - - $entity->hasField('annif_keywords')->willReturn(TRUE); - $entity->getKeywordFieldName()->willReturn('annif_keywords'); - $entity->getEntityTypeId()->willReturn('test_entity'); $entity->bundle()->willReturn('test_entity'); $entity->id()->willReturn($this->randomString()); - $field = $this->prophesize(FieldItemListInterface::class); - $field->isEmpty()->willReturn(!$hasKeywords); - $entity ->hasField(Argument::exact(TopicsManager::TOPICS_FIELD)) ->willReturn($hasKeywords !== NULL); + $entity->hasKeywords()->willReturn($hasKeywords ?? FALSE); + + $topicsEntity = $this->prophesize(SuggestedTopics::class); + + $field = $this->prophesize(EntityReferenceFieldItemListInterface::class); + $field->isEmpty()->willReturn(!$hasKeywords); + $field->referencedEntities()->willReturn([$topicsEntity->reveal()]); + $entity ->get(Argument::exact(TopicsManager::TOPICS_FIELD)) ->willReturn($field->reveal()); if (is_bool($shouldSave)) { if ($shouldSave) { - $entity->set(Argument::any(), Argument::any())->shouldBeCalled(); - $entity->save()->shouldBeCalled(); + $topicsEntity->set(Argument::any(), Argument::any())->shouldBeCalled(); + $topicsEntity->save()->shouldBeCalled(); } else { - $entity->save()->shouldNotBeCalled(); + $topicsEntity->save()->shouldNotBeCalled(); } } diff --git a/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php b/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php index e20374084..fea4599b5 100644 --- a/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Unit/Client/ApiClientTest.php @@ -22,7 +22,7 @@ * * @group helfi_annif */ -class KeywordClientTest extends UnitTestCase { +class ApiClientTest extends UnitTestCase { use AnnifApiTestTrait; diff --git a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php index 65c6a76a7..92bd8a56d 100644 --- a/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php +++ b/public/modules/custom/helfi_annif/tests/src/Unit/KeywordManagerTest.php @@ -29,7 +29,7 @@ class KeywordManagerTest extends UnitTestCase { */ public function testUnsupportedEntity(): void { // hasField(TopicsManager::KEYWORD_FIELD) for entity is FALSE. - $entity = $this->mockEntity(hasKeywords: NULL, hasKeywordField: FALSE); + $entity = $this->mockEntity(hasKeywords: NULL); $queue = $this->prophesize(QueueInterface::class); $queue ->createItem(Argument::any()) From 0c338ed7f76b944ee65c99149c926d86bb36c32d Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 08:55:16 +0300 Subject: [PATCH 10/14] UHF-10631: Configure form displays --- ...form_display.node.news_article.default.yml | 24 ++++++------------ ...ty_form_display.node.news_item.default.yml | 25 ++++++------------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/conf/cmi/core.entity_form_display.node.news_article.default.yml b/conf/cmi/core.entity_form_display.node.news_article.default.yml index ac8584095..13084b60a 100644 --- a/conf/cmi/core.entity_form_display.node.news_article.default.yml +++ b/conf/cmi/core.entity_form_display.node.news_article.default.yml @@ -19,13 +19,13 @@ dependencies: module: - field_group - hdbt_admin_tools + - helfi_annif - linkit - media_library - paragraphs - path - publication_date - radioactivity - - readonly_field_widget - scheduler - select2 third_party_settings: @@ -78,9 +78,9 @@ third_party_settings: required_fields: true group_automatically_recommended: children: + - annif_suggested_topics - in_recommendations - show_annif_block - - annif_keywords label: 'Automatically recommended content' region: content parent_name: '' @@ -99,19 +99,11 @@ targetEntityType: node bundle: news_article mode: default content: - annif_keywords: - type: readonly_field_widget - weight: 30 + annif_suggested_topics: + type: suggested_topics_reference + weight: 31 region: content - settings: - label: above - formatter_type: entity_reference_label - formatter_settings: - entity_reference_entity_view: - view_mode: default - entity_reference_label: - link: false - show_description: false + settings: { } third_party_settings: { } created: type: datetime_timestamp @@ -231,7 +223,7 @@ content: third_party_settings: { } in_recommendations: type: boolean_checkbox - weight: 28 + weight: 32 region: content settings: display_label: true @@ -275,7 +267,7 @@ content: third_party_settings: { } show_annif_block: type: boolean_checkbox - weight: 29 + weight: 33 region: content settings: display_label: true diff --git a/conf/cmi/core.entity_form_display.node.news_item.default.yml b/conf/cmi/core.entity_form_display.node.news_item.default.yml index 88d63a300..2ff8ed02a 100644 --- a/conf/cmi/core.entity_form_display.node.news_item.default.yml +++ b/conf/cmi/core.entity_form_display.node.news_item.default.yml @@ -19,13 +19,13 @@ dependencies: module: - field_group - hdbt_admin_tools + - helfi_annif - linkit - media_library - paragraphs - path - publication_date - radioactivity - - readonly_field_widget - scheduler - select2 third_party_settings: @@ -79,7 +79,6 @@ third_party_settings: group_updating_news: children: - field_news_item_updating_news - - field_news_item_updating_news label: 'Updating news' region: content parent_name: '' @@ -94,9 +93,9 @@ third_party_settings: required_fields: false group_automatically_recommended: children: + - annif_suggested_topics - in_recommendations - show_annif_block - - annif_keywords label: 'Automatically recommended content' region: content parent_name: '' @@ -115,19 +114,11 @@ targetEntityType: node bundle: news_item mode: default content: - annif_keywords: - type: readonly_field_widget - weight: 2 + annif_suggested_topics: + type: suggested_topics_reference + weight: 29 region: content - settings: - label: above - formatter_type: entity_reference_label - formatter_settings: - entity_reference_entity_view: - view_mode: default - entity_reference_label: - link: false - show_description: false + settings: { } third_party_settings: { } created: type: datetime_timestamp @@ -261,7 +252,7 @@ content: third_party_settings: { } in_recommendations: type: boolean_checkbox - weight: 0 + weight: 30 region: content settings: display_label: true @@ -305,7 +296,7 @@ content: third_party_settings: { } show_annif_block: type: boolean_checkbox - weight: 1 + weight: 31 region: content settings: display_label: true From 980d723e4fcb9361686e0e78b32f4bbd1985d89a Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 09:13:10 +0300 Subject: [PATCH 11/14] UHF-10631: Replace random function to pass Sonarcloud --- .../src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php index fbdecbad6..61e264821 100644 --- a/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php +++ b/public/modules/custom/helfi_annif/src/Plugin/Field/FieldType/ScoredEntityReferenceItem.php @@ -62,7 +62,7 @@ public static function schema(FieldStorageDefinitionInterface $field_definition) public static function generateSampleValue(FieldDefinitionInterface $field_definition): array { $values = parent::generateSampleValue($field_definition); - $values['score'] = mt_rand() / mt_getrandmax(); + $values['score'] = random_int(0, 100) / 100; return $values; } From 4010966df2dba8791826d5c290c5c8f76700a08b Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Tue, 24 Sep 2024 09:44:52 +0300 Subject: [PATCH 12/14] UHF-10631: Ignore GHSA-mg8j-w93w-xjgc --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e47af5f5e..ad1f32df6 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,8 @@ "php-http/discovery": false }, "audit": { - "abandoned": "report" + "abandoned": "report", + "ignore": ["GHSA-mg8j-w93w-xjgc"] } }, "extra": { From dda03eec6bcb41b11e4d97f86c75f8b43fad8aca Mon Sep 17 00:00:00 2001 From: hel-platta-automation <95360595+hel-platta-automation@users.noreply.github.com> Date: Tue, 24 Sep 2024 07:48:07 +0000 Subject: [PATCH 13/14] Update configuration --- .platform/schema | 2 +- composer.json | 3 +- composer.lock | 280 ++++++++++--------- conf/cmi/metatag.metatag_defaults.global.yml | 1 - conf/cmi/metatag.metatag_defaults.node.yml | 1 - 5 files changed, 145 insertions(+), 142 deletions(-) diff --git a/.platform/schema b/.platform/schema index 301160a93..f11c82a4c 100644 --- a/.platform/schema +++ b/.platform/schema @@ -1 +1 @@ -8 \ No newline at end of file +9 \ No newline at end of file diff --git a/composer.json b/composer.json index e47af5f5e..ad1f32df6 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,8 @@ "php-http/discovery": false }, "audit": { - "abandoned": "report" + "abandoned": "report", + "ignore": ["GHSA-mg8j-w93w-xjgc"] } }, "extra": { diff --git a/composer.lock b/composer.lock index b1ea2e7b4..9418039f9 100644 --- a/composer.lock +++ b/composer.lock @@ -609,24 +609,24 @@ }, { "name": "composer/semver", - "version": "3.4.2", + "version": "3.4.3", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", - "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -670,7 +670,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.2" + "source": "https://github.com/composer/semver/tree/3.4.3" }, "funding": [ { @@ -686,7 +686,7 @@ "type": "tidelift" } ], - "time": "2024-07-12T11:35:52+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { "name": "consolidation/annotated-command", @@ -4249,16 +4249,16 @@ }, { "name": "drupal/hdbt", - "version": "6.7.2", + "version": "6.7.4", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-hdbt.git", - "reference": "fc4412873b2fcac8af2bad7d1387b850424d6dc1" + "reference": "44597c4036c5e0d8bcac994b559bde68247979a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/fc4412873b2fcac8af2bad7d1387b850424d6dc1", - "reference": "fc4412873b2fcac8af2bad7d1387b850424d6dc1", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/44597c4036c5e0d8bcac994b559bde68247979a0", + "reference": "44597c4036c5e0d8bcac994b559bde68247979a0", "shasum": "" }, "require": { @@ -4277,10 +4277,10 @@ "Drupal" ], "support": { - "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/6.7.2", + "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/6.7.4", "issues": "https://github.com/City-of-Helsinki/drupal-hdbt/issues" }, - "time": "2024-09-19T13:24:34+00:00" + "time": "2024-09-24T07:41:36+00:00" }, { "name": "drupal/hdbt_admin", @@ -4467,12 +4467,12 @@ "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-tools.git", - "reference": "5c46212ec813932eb9f8e94bbf2d14e1e92b2a39" + "reference": "8df65343c4ff937dcf143827e3182f10b8b1b4b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/5c46212ec813932eb9f8e94bbf2d14e1e92b2a39", - "reference": "5c46212ec813932eb9f8e94bbf2d14e1e92b2a39", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/8df65343c4ff937dcf143827e3182f10b8b1b4b6", + "reference": "8df65343c4ff937dcf143827e3182f10b8b1b4b6", "shasum": "" }, "require": { @@ -4544,7 +4544,7 @@ "source": "https://github.com/City-of-Helsinki/drupal-tools/tree/main", "issues": "https://github.com/City-of-Helsinki/drupal-tools/issues" }, - "time": "2024-08-16T09:24:27+00:00" + "time": "2024-09-24T07:18:32+00:00" }, { "name": "drupal/helfi_navigation", @@ -4582,16 +4582,16 @@ }, { "name": "drupal/helfi_platform_config", - "version": "4.6.4", + "version": "4.6.6", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config.git", - "reference": "a5e8ef073740c91b4e8082ebf9901fa5c05f70cf" + "reference": "ad39a8887983f38dad1de4fae73fc4349730bdf3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/a5e8ef073740c91b4e8082ebf9901fa5c05f70cf", - "reference": "a5e8ef073740c91b4e8082ebf9901fa5c05f70cf", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/ad39a8887983f38dad1de4fae73fc4349730bdf3", + "reference": "ad39a8887983f38dad1de4fae73fc4349730bdf3", "shasum": "" }, "require": { @@ -4629,7 +4629,7 @@ "drupal/media_entity_file_replace": "^1.0", "drupal/menu_block_current_language": "^2.0", "drupal/menu_link_attributes": "^1.2", - "drupal/metatag": "^1.16", + "drupal/metatag": "^2", "drupal/oembed_providers": "^2.0", "drupal/paragraphs": "^1.12", "drupal/paragraphs_asymmetric_translation_widgets": "^1.0", @@ -4709,10 +4709,10 @@ ], "description": "HELfi platform config", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.4", + "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/4.6.6", "issues": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/issues" }, - "time": "2024-09-18T06:15:59+00:00" + "time": "2024-09-24T07:40:24+00:00" }, { "name": "drupal/helfi_proxy", @@ -5718,42 +5718,45 @@ }, { "name": "drupal/metatag", - "version": "1.26.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://git.drupalcode.org/project/metatag.git", - "reference": "8.x-1.26" + "reference": "2.0.2" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/metatag-8.x-1.26.zip", - "reference": "8.x-1.26", - "shasum": "afa4a37422748baa2f0c35b13961438668ef3be8" + "url": "https://ftp.drupal.org/files/projects/metatag-2.0.2.zip", + "reference": "2.0.2", + "shasum": "748013c50a0ed5e10359413bb3481392a0bf0d3f" }, "require": { - "drupal/core": "^9.3 || ^10", - "drupal/token": "^1.0" + "drupal/core": "^9.4 || ^10 || ^11", + "drupal/token": "^1.0", + "php": ">=8.0" }, "require-dev": { - "drupal/devel": "^4.0 || ^5.0", - "drupal/hal": "^9 || ^1 || ^2", + "drupal/hal": "^1 || ^2 || ^9", "drupal/metatag_dc": "*", "drupal/metatag_open_graph": "*", "drupal/page_manager": "^4.0", - "drupal/panelizer": "^4.0", "drupal/redirect": "^1.0", - "drupal/webprofiler": "^9 || ^10", + "ergebnis/composer-normalize": "*", "mpyw/phpunit-patch-serializable-comparison": "*" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.26", - "datestamp": "1687856123", + "version": "2.0.2", + "datestamp": "1722869772", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" } + }, + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" } }, "notification-url": "https://packages.drupal.org/8/downloads", @@ -6807,26 +6810,26 @@ }, { "name": "drupal/readonly_field_widget", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/readonly_field_widget.git", - "reference": "8.x-1.5" + "reference": "8.x-1.6" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/readonly_field_widget-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "936bfb182d2c406501fb279dd3977d4c29113c3f" + "url": "https://ftp.drupal.org/files/projects/readonly_field_widget-8.x-1.6.zip", + "reference": "8.x-1.6", + "shasum": "595c7b27ddbf535594d9a4e2d8fb206dd50e2a63" }, "require": { - "drupal/core": "^8 || ^9 || ^10" + "drupal/core": "^8 || ^9 || ^10 || ^11" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.5", - "datestamp": "1660464949", + "version": "8.x-1.6", + "datestamp": "1726986724", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -6843,10 +6846,11 @@ "homepage": "https://www.drupal.org/user/287467" } ], - "description": "Provides a field widget which can display the field formatter version of a field on the edit form", + "description": "Provides a field widget which can display the field formatter version of a field on the edit form.", "homepage": "https://www.drupal.org/project/readonly_field_widget", "support": { - "source": "https://git.drupalcode.org/project/readonly_field_widget" + "source": "https://git.drupalcode.org/project/readonly_field_widget", + "issues": "https://www.drupal.org/project/issues/readonly_field_widget" } }, { @@ -10194,16 +10198,16 @@ }, { "name": "league/mime-type-detection", - "version": "1.15.0", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", "shasum": "" }, "require": { @@ -10234,7 +10238,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" }, "funding": [ { @@ -10246,7 +10250,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T23:22:08+00:00" + "time": "2024-09-21T08:32:55+00:00" }, { "name": "league/uri", @@ -12465,16 +12469,16 @@ }, { "name": "symfony/console", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998" + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/42686880adaacdad1835ee8fc2a9ec5b7bd63998", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "url": "https://api.github.com/repos/symfony/console/zipball/72d080eb9edf80e36c19be61f72c98ed8273b765", + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765", "shasum": "" }, "require": { @@ -12539,7 +12543,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.11" + "source": "https://github.com/symfony/console/tree/v6.4.12" }, "funding": [ { @@ -12555,20 +12559,20 @@ "type": "tidelift" } ], - "time": "2024-08-15T22:48:29+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e" + "reference": "cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e", - "reference": "e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e", + "reference": "cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e", "shasum": "" }, "require": { @@ -12620,7 +12624,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.11" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.12" }, "funding": [ { @@ -12636,7 +12640,7 @@ "type": "tidelift" } ], - "time": "2024-08-29T08:15:38+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/deprecation-contracts", @@ -12938,16 +12942,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.9", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/f810e3cbdf7fdc35983968523d09f349fa9ada12", + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12", "shasum": "" }, "require": { @@ -12984,7 +12988,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.9" + "source": "https://github.com/symfony/filesystem/tree/v6.4.12" }, "funding": [ { @@ -13000,7 +13004,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:49:33+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/finder", @@ -13068,16 +13072,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.10", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b" + "reference": "133ac043875f59c26c55e79cf074562127cce4d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/117f1f20a7ade7bcea28b861fb79160a21a1e37b", - "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/133ac043875f59c26c55e79cf074562127cce4d2", + "reference": "133ac043875f59c26c55e79cf074562127cce4d2", "shasum": "" }, "require": { @@ -13125,7 +13129,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.10" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.12" }, "funding": [ { @@ -13141,20 +13145,20 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:36:27+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79" + "reference": "96df83d51b5f78804f70c093b97310794fd6257b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1ba6b89d781cb47448155cc70dd2e0f1b0584c79", - "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/96df83d51b5f78804f70c093b97310794fd6257b", + "reference": "96df83d51b5f78804f70c093b97310794fd6257b", "shasum": "" }, "require": { @@ -13239,7 +13243,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.11" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.12" }, "funding": [ { @@ -13255,20 +13259,20 @@ "type": "tidelift" } ], - "time": "2024-08-30T16:57:20+00:00" + "time": "2024-09-21T06:02:57+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.9", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45" + "reference": "b6a25408c569ae2366b3f663a4edad19420a9c26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45", - "reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45", + "url": "https://api.github.com/repos/symfony/mailer/zipball/b6a25408c569ae2366b3f663a4edad19420a9c26", + "reference": "b6a25408c569ae2366b3f663a4edad19420a9c26", "shasum": "" }, "require": { @@ -13319,7 +13323,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.9" + "source": "https://github.com/symfony/mailer/tree/v6.4.12" }, "funding": [ { @@ -13335,20 +13339,20 @@ "type": "tidelift" } ], - "time": "2024-06-28T07:59:05+00:00" + "time": "2024-09-08T12:30:05+00:00" }, { "name": "symfony/mime", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "dba5d5f6073baf7a3576b580cc4a208b4ca00553" + "reference": "abe16ee7790b16aa525877419deb0f113953f0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/dba5d5f6073baf7a3576b580cc4a208b4ca00553", - "reference": "dba5d5f6073baf7a3576b580cc4a208b4ca00553", + "url": "https://api.github.com/repos/symfony/mime/zipball/abe16ee7790b16aa525877419deb0f113953f0e1", + "reference": "abe16ee7790b16aa525877419deb0f113953f0e1", "shasum": "" }, "require": { @@ -13404,7 +13408,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.11" + "source": "https://github.com/symfony/mime/tree/v6.4.12" }, "funding": [ { @@ -13420,7 +13424,7 @@ "type": "tidelift" } ], - "time": "2024-08-13T12:15:02+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/options-resolver", @@ -14268,16 +14272,16 @@ }, { "name": "symfony/process", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5" + "reference": "3f94e5f13ff58df371a7ead461b6e8068900fbb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8d92dd79149f29e89ee0f480254db595f6a6a2c5", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "url": "https://api.github.com/repos/symfony/process/zipball/3f94e5f13ff58df371a7ead461b6e8068900fbb3", + "reference": "3f94e5f13ff58df371a7ead461b6e8068900fbb3", "shasum": "" }, "require": { @@ -14309,7 +14313,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.8" + "source": "https://github.com/symfony/process/tree/v6.4.12" }, "funding": [ { @@ -14325,7 +14329,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-17T12:47:12+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -14412,16 +14416,16 @@ }, { "name": "symfony/routing", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a" + "reference": "a7c8036bd159486228dc9be3e846a00a0dda9f9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a", - "reference": "8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a", + "url": "https://api.github.com/repos/symfony/routing/zipball/a7c8036bd159486228dc9be3e846a00a0dda9f9f", + "reference": "a7c8036bd159486228dc9be3e846a00a0dda9f9f", "shasum": "" }, "require": { @@ -14475,7 +14479,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.11" + "source": "https://github.com/symfony/routing/tree/v6.4.12" }, "funding": [ { @@ -14491,20 +14495,20 @@ "type": "tidelift" } ], - "time": "2024-08-29T08:15:38+00:00" + "time": "2024-09-20T08:32:26+00:00" }, { "name": "symfony/serializer", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "a75d03d7720417f8a654e73e8f02acdea8779cd0" + "reference": "10ae9c1b90f4809ccb7277cc8fe8d80b3af4412c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/a75d03d7720417f8a654e73e8f02acdea8779cd0", - "reference": "a75d03d7720417f8a654e73e8f02acdea8779cd0", + "url": "https://api.github.com/repos/symfony/serializer/zipball/10ae9c1b90f4809ccb7277cc8fe8d80b3af4412c", + "reference": "10ae9c1b90f4809ccb7277cc8fe8d80b3af4412c", "shasum": "" }, "require": { @@ -14573,7 +14577,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.4.11" + "source": "https://github.com/symfony/serializer/tree/v6.4.12" }, "funding": [ { @@ -14589,7 +14593,7 @@ "type": "tidelift" } ], - "time": "2024-08-17T07:51:47+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/service-contracts", @@ -14676,16 +14680,16 @@ }, { "name": "symfony/string", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b" + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bc3eb632cf9c8dbfd6529d89be9950d1518883b", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "url": "https://api.github.com/repos/symfony/string/zipball/f8a1ccebd0997e16112dfecfd74220b78e5b284b", + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b", "shasum": "" }, "require": { @@ -14742,7 +14746,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.11" + "source": "https://github.com/symfony/string/tree/v6.4.12" }, "funding": [ { @@ -14758,7 +14762,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:55:28+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/translation-contracts", @@ -14840,16 +14844,16 @@ }, { "name": "symfony/validator", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "4ff41cf10af1de99ad92895411b55c9f309bc2d8" + "reference": "6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/4ff41cf10af1de99ad92895411b55c9f309bc2d8", - "reference": "4ff41cf10af1de99ad92895411b55c9f309bc2d8", + "url": "https://api.github.com/repos/symfony/validator/zipball/6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0", + "reference": "6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0", "shasum": "" }, "require": { @@ -14917,7 +14921,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.11" + "source": "https://github.com/symfony/validator/tree/v6.4.12" }, "funding": [ { @@ -14933,7 +14937,7 @@ "type": "tidelift" } ], - "time": "2024-08-30T15:57:55+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/var-dumper", @@ -15098,16 +15102,16 @@ }, { "name": "symfony/yaml", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "be37e7f13195e05ab84ca5269365591edd240335" + "reference": "762ee56b2649659380e0ef4d592d807bc17b7971" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/be37e7f13195e05ab84ca5269365591edd240335", - "reference": "be37e7f13195e05ab84ca5269365591edd240335", + "url": "https://api.github.com/repos/symfony/yaml/zipball/762ee56b2649659380e0ef4d592d807bc17b7971", + "reference": "762ee56b2649659380e0ef4d592d807bc17b7971", "shasum": "" }, "require": { @@ -15150,7 +15154,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.11" + "source": "https://github.com/symfony/yaml/tree/v6.4.12" }, "funding": [ { @@ -15166,7 +15170,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:55:28+00:00" + "time": "2024-09-17T12:47:12+00:00" }, { "name": "t4web/composer-lock-parser", @@ -18207,16 +18211,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.1", + "version": "1.31.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e" + "reference": "249f15fb843bf240cf058372dad29e100cee6c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/249f15fb843bf240cf058372dad29e100cee6c17", + "reference": "249f15fb843bf240cf058372dad29e100cee6c17", "shasum": "" }, "require": { @@ -18248,9 +18252,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.31.0" }, - "time": "2024-09-07T20:13:05+00:00" + "time": "2024-09-22T11:32:18+00:00" }, { "name": "phpstan/phpstan", diff --git a/conf/cmi/metatag.metatag_defaults.global.yml b/conf/cmi/metatag.metatag_defaults.global.yml index bbc61c1d4..5e6485f01 100644 --- a/conf/cmi/metatag.metatag_defaults.global.yml +++ b/conf/cmi/metatag.metatag_defaults.global.yml @@ -9,7 +9,6 @@ label: Global tags: canonical_url: '[current-page:url]' title: '[current-page:title] | [site:page-title-suffix]' - twitter_cards_page_url: '[current-page:url]' twitter_cards_title: '[current-page:title] | [site:page-title-suffix]' twitter_cards_type: summary_large_image og_image: '[site:shareable-image]' diff --git a/conf/cmi/metatag.metatag_defaults.node.yml b/conf/cmi/metatag.metatag_defaults.node.yml index 44905c69d..446b9d45e 100644 --- a/conf/cmi/metatag.metatag_defaults.node.yml +++ b/conf/cmi/metatag.metatag_defaults.node.yml @@ -12,7 +12,6 @@ tags: canonical_url: '[node:url]' article_modified_time: '[node:changed:html_datetime]' article_published_time: '[node:created:html_datetime]' - content_language: '[node:langcode]' og_title: '[node:title]' og_updated_time: '[node:changed:html_datetime]' og_url: '[current-page:url:absolute]' From ca4ae64f049a99a3218994794a07b0babd97dc19 Mon Sep 17 00:00:00 2001 From: hel-platta-automation <95360595+hel-platta-automation@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:36:16 +0000 Subject: [PATCH 14/14] Update configuration --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9418039f9..32b2570ad 100644 --- a/composer.lock +++ b/composer.lock @@ -4284,16 +4284,16 @@ }, { "name": "drupal/hdbt_admin", - "version": "3.2.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-hdbt-admin.git", - "reference": "ec3dd354701a8adef5607d1c20b2679aab0e1dfb" + "reference": "efc4c163c283f45d9dc341bf56a399d97d117ebe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt-admin/zipball/ec3dd354701a8adef5607d1c20b2679aab0e1dfb", - "reference": "ec3dd354701a8adef5607d1c20b2679aab0e1dfb", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt-admin/zipball/efc4c163c283f45d9dc341bf56a399d97d117ebe", + "reference": "efc4c163c283f45d9dc341bf56a399d97d117ebe", "shasum": "" }, "require": { @@ -4314,10 +4314,10 @@ "Drupal" ], "support": { - "source": "https://github.com/City-of-Helsinki/drupal-hdbt-admin/tree/3.2.1", + "source": "https://github.com/City-of-Helsinki/drupal-hdbt-admin/tree/3.2.2", "issues": "https://github.com/City-of-Helsinki/drupal-hdbt-admin/issues" }, - "time": "2024-08-30T10:27:35+00:00" + "time": "2024-09-24T11:30:53+00:00" }, { "name": "drupal/health_check",