-
Notifications
You must be signed in to change notification settings - Fork 3
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-8909 Preprocess function refactor #1028
Conversation
…on as it's not used anywhere, and moved the active_theme variable to hdbt_preprocess_page() as its used only in page template. Also removed theme_path variable from hdbt_preprocess() function as it's not necessary to be added on every single preprocess. The theme_path is added via hdbt_preprocess_html(), hdbt_preprocess_page() and hdbt_preprocess_paragraph__calculator(), and the variable is used in html, page and calculator paragraph twig files.
…et's move it away from hdbt_preprocess() function and set it once in hdbt_preprocess_html().
…() and copied it to hdbt_preprocess_html(), hdbt_preprocess_page(), hdbt_preprocess_block() and hdbt_preprocess_menu(). Also moved search_dropdown and global_menu variables away from hdbt_preprocess() function and set them in hdbt_preprocess_html() instead.
… copied it to hdbt_preprocess_html() as its only used in html.html.twig.
…() and moved it to the image-placeholder.twig template.
…it to the koro.twig template. Also removed the koro mentions from paragraph--content-cards.html.twig, page.html.twig and hero.twig.
|
… moved it to the html.html.twig template. Also moved the theme color override to hdbt_preprocess_html().
…rnative_language variables to be set only once in hdbt_preprocess() to optimize the call stack. Also further optimized the helfi_navigation module existence check.
…rnative_language variables to be set only once in hdbt_preprocess() to optimize the call stack. Also further optimized the helfi_navigation module existence check.
…ink and node--announcement--default templates/preprocesses.
…ocess was moved to helfi_paragraphs_hearings module.
…nk.twig and field--tpr-unit--provided-languages.html.twig, and added the language object to tpr-unit.html.twig. The preprocesses have been added to helfi_tpr_config module.
…age functions to be self-dependent and not depend of variables array.
Attach this to the release notes: |
…thin helfi_api_base module.
…anguage via service.
…anguage via service.
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.
These changes causes currently InvalidArgumentException: The URI '' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 293 of core/lib/Drupal/Core/Url.php). on Finnish language front pages of KYMP and Strategia at least.
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.
Really great work with refactoring the hdbt.theme file - everything works as it should 🦖
These changes were fixed and Tuutti has left the building.
UHF-8909
What was done
theme_prefix
variable fromhdbt_preprocess()
function as it's not used anywhere, and moved theactive_theme
variable tohdbt_preprocess_page()
as its used only in page template.theme_path
variable fromhdbt_preprocess()
function as it's not necessary to be added on every single preprocess. Thetheme_path
is added viahdbt_preprocess_html()
,hdbt_preprocess_page()
andhdbt_preprocess_paragraph__calculator()
, and the variable is used in html, page and calculator paragraph twig files.helfi_instance_name
variable is only needed in JS, let's move it away fromhdbt_preprocess()
function and set it once inhdbt_preprocess_html()
.use_global_navigation
variable fromhdbt_preprocess()
and copied it tohdbt_preprocess_html()
,hdbt_preprocess_page()
,hdbt_preprocess_block()
andhdbt_preprocess_menu()
.search_dropdown
andglobal_menu
variables away fromhdbt_preprocess()
function and set them inhdbt_preprocess_html()
instead.theme_color
variable fromhdbt_preprocess()
and copied it tohdbt_preprocess_html()
as its only used inhtml.html.twig
.image_placeholder
variable fromhdbt_preprocess()
and moved it to theimage-placeholder.twig
template.koro
variable fromhdbt_preprocess()
and moved it to thekoro.twig
template. Also removed the koro mentions fromparagraph--content-cards.html.twig
,page.html.twig and hero.twig
.theme_color
variable fromhdbt_preprocess()
and moved it to thehtml.html.twig
template. Also moved the theme color override tohdbt_preprocess_html()
.helfi_navigation
existence.current_language
,navigation_enabled
andalternative_language
variables to be set only once inhdbt_preprocess()
to optimize the call stack. Also further optimized thehelfi_navigation
module existence check.{{ language.id}}
.helfi_api_base
module.How to install
git pull origin dev
make fresh
composer require drupal/hdbt:dev-UHF-8909 drupal/hdbt_admin:dev-UHF-8909 drupal/helfi_api_base:dev-UHF-8909
make drush-cr
How to test
koro
theme_color
image_placeholder
language.id
.current_langcode
variable, which has been changed to uselanguage
object. See the documentation.language.name
current_language
variable, which has been changed to uselanguage
object.language.direction
current_language_dir
variable, which has been changed to uselanguage
object.alternative_language
helfi_api_base
. Try this functionality out in Etusivu -instance. Choose an "alternative" language from content list and check that the fallback attributesfallback_lang, fallback_dir
still works the same way as before.use_global_navigation
use_global_navigation
variable initialisation was moved to more precise preprocesses(hdbt_preprocess_html, hdbt_preprocess_page, hdbt_preprocess_input__submit, hdbt_preprocess_block).
Check that the functionality works as before.drupalSettings.hdbt.global_menu
,drupalSettings.hdbt.search_dropdown
anddrupalSettings.helfi_instance_name
javascript variables.hdbt_preprocess_html
as the attached javascript variables only need to be set once during page load. You can test the variables by copying the variable path to terminal window in your browsertheme_color
override.active_theme
active_theme
variable is used inpage.html.twig
to indicate the prefixes for block templates. It has been moved tohdbt_preprocess_page
. Check that the blocks (like: site branding or language switcher) still works as before.theme_prefix
theme_prefix
variable was removed as it's not in use anywhere.theme_path
theme_path
variable initialisation was moved tohdbt_preprocess_html
and copied tohdbt_preprocess_page
andhdbt_preprocess_paragraph__calculator
. Check that the theme paths work forhtml.html.twig
favicons,page--404.html.twig
illustrations and that the Calculator paragraphs works as before as the theme path is rather strangely used for loading different calculator JS files.Continuous documentation
Translations
Other PRs