Skip to content

Commit da6f9f1

Browse files
committed
Merge branch 'dev' into update-configuration
2 parents 547e15d + ad1cea1 commit da6f9f1

5 files changed

Lines changed: 25 additions & 10 deletions

File tree

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
settings:
22
label: Administration
3-
label_display: synlig
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
settings:
22
label: Verktyg
3-
label_display: synlig

public/modules/custom/helfi_kasko_content/src/Plugin/search_api/processor/AdditionalFilters.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class AdditionalFilters extends ProcessorPluginBase {
2828

2929
use SupportsUnitIndexTrait;
3030

31+
const ENGLISH_EDUCATION_TERM_IDS = [149, 150];
32+
3133
/**
3234
* {@inheritdoc}
3335
*/
@@ -65,6 +67,7 @@ public function addFieldValues(ItemInterface $item): void {
6567
'grades_7_9' => UnitCategoryUtility::entityHasCategory($object, UnitCategoryUtility::GRADES_7_9),
6668
'finnish_education' => UnitCategoryUtility::entityHasCategory($object, UnitCategoryUtility::FINNISH_BASIC_EDUCATION),
6769
'swedish_education' => UnitCategoryUtility::entityHasCategory($object, UnitCategoryUtility::SWEDISH_BASIC_EDUCATION),
70+
'english_education' => $this->hasEnglishEducation($object),
6871
];
6972

7073
$itemFields = $item->getFields();
@@ -75,4 +78,26 @@ public function addFieldValues(ItemInterface $item): void {
7578
}
7679
}
7780

81+
/**
82+
* Check if entity has English education category.
83+
*
84+
* @param \Drupal\helfi_tpr\Entity\TprEntityBase $entity
85+
* The TPR entity.
86+
*
87+
* @return bool
88+
* TRUE if entity has English education category, FALSE otherwise.
89+
*/
90+
private function hasEnglishEducation(TprEntityBase $entity): bool {
91+
if (!$entity->hasField('ontologyword_ids')) {
92+
return FALSE;
93+
}
94+
95+
foreach ($entity->get('ontologyword_ids')->getValue() as $term) {
96+
if (in_array($term['value'], self::ENGLISH_EDUCATION_TERM_IDS)) {
97+
return TRUE;
98+
}
99+
}
100+
return FALSE;
101+
}
102+
78103
}

public/modules/custom/helfi_kasko_content/translations/fi.po

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ msgctxt "TPR Ontologyword details schools"
6666
msgid "Weighted curriculum education starting in 7th grade"
6767
msgstr "7. luokalta alkava painotettu opetus"
6868

69-
msgctxt "TPR Ontologyword details schools"
70-
msgid "Teaching in English"
71-
msgstr "Englanninkielinen opetus"
72-
7369
msgctxt "TPR Ontologyword details schools"
7470
msgid "Finnish-English"
7571
msgstr "suomi-englanti"

public/modules/custom/helfi_kasko_content/translations/sv.po

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ msgctxt "TPR Ontologyword details schools"
6666
msgid "Weighted curriculum education starting in 7th grade"
6767
msgstr "Intensifierad undervisning som börjar i åk 7"
6868

69-
msgctxt "TPR Ontologyword details schools"
70-
msgid "Teaching in English"
71-
msgstr "Undervisning på engelska"
72-
7369
msgctxt "TPR Ontologyword details schools"
7470
msgid "Finnish-English"
7571
msgstr "finska-engelska"

0 commit comments

Comments
 (0)