-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UHF-10773: Helsinki near you - Services block #793
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5d85bf3
UHF-10773: Add services near you block to Helsinki near you results p…
teroelonen f657e85
UHF-10773: Add URL generation for kartta.hel.fi links
jeremysteerio d1b823a
UHF-10773: Tweak near-you results template
jeremysteerio 81c6482
UHF-10773: Add internal link generation
jeremysteerio 46b36e2
UHF-10773: Fix phpcs
jeremysteerio e6894dd
Merge branch 'dev' of github.com:City-of-Helsinki/drupal-helfi-etusiv…
9942c84
UHF-10773: Add missing Finnish translation
01d513b
UHF-10773: Add language param to external links of helsinki near you
jeremysteerio d82ea34
UHF-10773: Also set langauage param for finnish external links
jeremysteerio 54fb891
UHF-10773: Move filter call after null check
jeremysteerio 69f5607
UHF-10773: Add missing translations
jeremysteerio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
public/modules/custom/helfi_etusivu/src/Enum/InternalSearchLink.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\helfi_etusivu\Enum; | ||
|
||
/** | ||
* Enum class for internal search links. | ||
* | ||
* For now this class is just a "stupid" enum class with a list of links. | ||
* This should probably be reworked into a more robust solution in the future. | ||
*/ | ||
enum InternalSearchLink { | ||
case HEALTH_STATIONS; | ||
case CHILD_HEALTH_STATIONS; | ||
case SCHOOLS; | ||
case PLAYGROUNDS_FAMILY_HOUSES; | ||
case DAYCARES; | ||
case PLOWING_SCHEDULES; | ||
|
||
/** | ||
* Return array of link translations. | ||
* | ||
* @return array | ||
* Array of link translations. | ||
*/ | ||
public function getLinkTranslations() : array { | ||
return match ($this) { | ||
InternalSearchLink::HEALTH_STATIONS => [ | ||
'fi' => 'https://www.hel.fi/fi/sosiaali-ja-terveyspalvelut/terveydenhoito/terveysasemat', | ||
'sv' => 'https://www.hel.fi/sv/social-och-halsovardstjanster/halsovard/halsostationer', | ||
'en' => 'https://www.hel.fi/en/health-and-social-services/health-care/health-stations', | ||
], | ||
InternalSearchLink::CHILD_HEALTH_STATIONS => [ | ||
'fi' => 'https://www.hel.fi/fi/sosiaali-ja-terveyspalvelut/lasten-ja-perheiden-palvelut/aitiys-ja-lastenneuvolat', | ||
'sv' => 'https://www.hel.fi/sv/social-och-halsovardstjanster/tjanster-for-barn-och-familjer/modra-och-barnradgivningarna', | ||
'en' => 'https://www.hel.fi/en/health-and-social-services/child-and-family-services/maternity-and-child-health-clinics', | ||
], | ||
InternalSearchLink::SCHOOLS => [ | ||
'fi' => 'https://www.hel.fi/fi/kasvatus-ja-koulutus/perusopetus/peruskoulut', | ||
'sv' => 'https://www.hel.fi/sv/fostran-och-utbildning/grundlaggande-utbildning/grundskolor', | ||
'en' => 'https://www.hel.fi/en/childhood-and-education/basic-education/comprehensive-schools', | ||
], | ||
InternalSearchLink::PLAYGROUNDS_FAMILY_HOUSES => [ | ||
'fi' => 'https://www.hel.fi/fi/kasvatus-ja-koulutus/leikkipuistot/leikkipuistot-ja-perhetalot', | ||
'sv' => 'https://www.hel.fi/sv/fostran-och-utbildning/lekparker/sok-lekparker-och-familjehus', | ||
'en' => 'https://www.hel.fi/en/childhood-and-education/playgrounds/find-playgrounds-and-family-houses', | ||
], | ||
InternalSearchLink::DAYCARES => [ | ||
'fi' => 'https://www.hel.fi/fi/kasvatus-ja-koulutus/varhaiskasvatus/varhaiskasvatus-paivakodissa/etsi-kunnallisia-paivakoteja', | ||
'sv' => 'https://www.hel.fi/sv/fostran-och-utbildning/smabarnspedagogik/smabarnspedagogik-pa-daghem/sok-kommunala-daghem', | ||
'en' => 'https://www.hel.fi/en/childhood-and-education/early-childhood-education/early-childhood-education-in-daycare-centres/search-municipal-daycare-centres', | ||
], | ||
InternalSearchLink::PLOWING_SCHEDULES => [ | ||
'fi' => 'https://www.hel.fi/fi/kaupunkiymparisto-ja-liikenne/kunnossapito/katujen-kunnossapito/katujen-talvikunnossapito', | ||
'sv' => 'https://www.hel.fi/sv/stadsmiljo-och-trafik/underhall/gatuunderhall/vinterunderhall-av-gator', | ||
'en' => 'https://www.hel.fi/en/urban-environment-and-traffic/general-maintenance/street-maintenance/winter-street-maintenance', | ||
], | ||
}; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
public/modules/custom/helfi_etusivu/src/Enum/ServiceMapLink.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\helfi_etusivu\Enum; | ||
|
||
/** | ||
* Enum class for service map links. | ||
*/ | ||
enum ServiceMapLink { | ||
case ROADWORK_EVENTS; | ||
case CITYBIKE_STATIONS_STANDS; | ||
case STREET_PARK_PROJECTS; | ||
case PLANS_IN_PROCESS; | ||
|
||
/** | ||
* Get link param for service map. | ||
* | ||
* @return string | ||
* Link param. | ||
*/ | ||
public function link(): string { | ||
return match($this) { | ||
ServiceMapLink::ROADWORK_EVENTS => 'eCBuut', | ||
ServiceMapLink::CITYBIKE_STATIONS_STANDS => 'eCAduu', | ||
ServiceMapLink::STREET_PARK_PROJECTS => 'eCBJGT', | ||
ServiceMapLink::PLANS_IN_PROCESS => 'eCCv3K', | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes a deprecated function warning if the query parameter is left empty. Should we check if this is NULL or empty before running it through the filter?