Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1209: Rework window.s translations inline script
- TMS-1201: Add iframe-field for accordion-blocks video field

## [1.66.1] - 2025-10-01
Expand Down
98 changes: 53 additions & 45 deletions lib/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function hooks() : void {
0
);

add_filter(
\add_filter(
'script_loader_tag',
\Closure::fromCallable( [ $this, 'add_script_attributes' ] ),
10,
Expand All @@ -89,18 +89,18 @@ private function add_editor_styles() : void {
* @param string $theme Theme file name without prefix 'theme_' or suffix '.js/.css'.
*/
protected function enqueue_theme( $theme = 'tunnelma' ) : void {
$css = apply_filters( 'tms/theme/theme_css_file', sprintf( 'theme_%s.css', $theme ) );
$js = apply_filters( 'tms/theme/theme_js_file', sprintf( 'theme_%s.js', $theme ) );
$css = \apply_filters( 'tms/theme/theme_css_file', sprintf( 'theme_%s.css', $theme ) );
$js = \apply_filters( 'tms/theme/theme_js_file', sprintf( 'theme_%s.js', $theme ) );

\wp_enqueue_style(
'theme-css',
apply_filters(
\apply_filters(
'tms/theme/theme_css_path',
DPT_ASSET_URI . '/' . $css,
$css
),
[],
apply_filters(
\apply_filters(
'tms/theme/asset_mod_time',
static::get_theme_asset_mod_time( $css ),
$css
Expand All @@ -110,13 +110,13 @@ protected function enqueue_theme( $theme = 'tunnelma' ) : void {

\wp_enqueue_script(
'theme-js',
apply_filters(
\apply_filters(
'tms/theme/theme_js_path',
DPT_ASSET_URI . '/' . $js,
$js
),
[ 'jquery', 'vendor-js' ],
apply_filters(
\apply_filters(
'tms/theme/asset_mod_time',
static::get_theme_asset_mod_time( $js ),
$js
Expand All @@ -131,26 +131,26 @@ protected function enqueue_theme( $theme = 'tunnelma' ) : void {
private function enqueue_assets() : void {
\wp_enqueue_script(
'vendor-js',
apply_filters(
\apply_filters(
'tms/theme/theme_js_path',
DPT_ASSET_URI . '/vendor.js',
'vendor.js'
),
[ 'jquery', 'wp-a11y' ],
apply_filters(
\apply_filters(
'tms/theme/asset_mod_time',
static::get_theme_asset_mod_time( 'vendor.js' ),
'vendor.js'
),
true
);

$theme_default_color = apply_filters(
$theme_default_color = \apply_filters(
'tms/theme/theme_default_color',
DEFAULT_THEME_COLOR
);

$selected_theme = apply_filters(
$selected_theme = \apply_filters(
'tms/theme/theme_selected',
Settings::get_setting( 'theme_color' ) ?? $theme_default_color
);
Expand All @@ -160,11 +160,19 @@ private function enqueue_assets() : void {
/**
* Add localizations to window.s object.
*/
\wp_localize_script( 'theme-js', 's', ( new \Strings() )->s() );
\wp_add_inline_script(
'theme-js',
'var s = ' . json_encode( ( new \Strings() )->s() ) . ';',
'before'
);

\wp_localize_script( 'theme-js', 'themeData', [
'assetsUri' => esc_url( get_template_directory_uri() ),
] );
\wp_add_inline_script(
'theme-js',
'var themeData = ' . json_encode( [
'assetsUri' => \esc_url( \get_template_directory_uri() ),
] ) . ';',
'before'
);

\wp_dequeue_style( 'wp-block-library' );

Expand Down Expand Up @@ -397,36 +405,36 @@ protected function get_theme_icons() {
*/
public static function get_accessibility_icons() {
return [
'aaniopastus' => __( 'Audio guide', 'tms-theme-base' ),
'avustaja' => __( 'Assistant', 'tms-theme-base' ),
'hissi' => __( 'Lift', 'tms-theme-base' ),
'induktiosilmukka' => __( 'Induction loop', 'tms-theme-base' ),
'info' => __( 'Information', 'tms-theme-base' ),
'internet' => __( 'Internet', 'tms-theme-base' ),
'isa' => __( 'Accessible entrance, Accessible toilet, Accessible parking', 'tms-theme-base' ),
'kahvila' => __( 'Café', 'tms-theme-base' ),
'kauppa' => __( 'Shop', 'tms-theme-base' ),
'kokoustilaa' => __( 'Meeting room', 'tms-theme-base' ),
'lainattavia-valineita' => __( 'Assistive device lending', 'tms-theme-base' ),
'lastenhoitotila' => __( 'Baby changing', 'tms-theme-base' ),
'latauspiste' => __( 'Charging point', 'tms-theme-base' ),
'lipunmyynti' => __( 'Ticket sales', 'tms-theme-base' ),
'luiska' => __( 'Ramp', 'tms-theme-base' ),
'nakovammaisia_helpottavat_palvelut' => __( 'Services for the visually impaired', 'tms-theme-base' ),
'opaskoirat_sallittu' => __( 'Service dogs allowed', 'tms-theme-base' ),
'pistekirjoitus' => __( 'Braille', 'tms-theme-base' ),
'porrashissi' => __( 'Stairlift', 'tms-theme-base' ),
'portaat' => __( 'Staircase', 'tms-theme-base' ),
'pyoratuolihissi' => __( 'Platform lift', 'tms-theme-base' ),
'rollaattori' => __( 'Rollator, walker', 'tms-theme-base' ),
'sahkomopon_sailytys' => __( 'Electric mobility scooter storage', 'tms-theme-base' ),
'sailytyslokerot' => __( 'Lockers', 'tms-theme-base' ),
'suuri_teksti' => __( 'Large print', 'tms-theme-base' ),
'vaatesailytys' => __( 'Cloakroom', 'tms-theme-base' ),
'viitomakielinen_palvelu' => __( 'Sign-language services', 'tms-theme-base' ),
'wc_oikea' => __( 'Accessible toilet: one-sided access', 'tms-theme-base' ),
'wc_vasen' => __( 'Accessible toilet: one-sided access', 'tms-theme-base' ),
'wc' => __( 'WC', 'tms-theme-base' ),
'aaniopastus' => \__( 'Audio guide', 'tms-theme-base' ),
'avustaja' => \__( 'Assistant', 'tms-theme-base' ),
'hissi' => \__( 'Lift', 'tms-theme-base' ),
'induktiosilmukka' => \__( 'Induction loop', 'tms-theme-base' ),
'info' => \__( 'Information', 'tms-theme-base' ),
'internet' => \__( 'Internet', 'tms-theme-base' ),
'isa' => \__( 'Accessible entrance, Accessible toilet, Accessible parking', 'tms-theme-base' ),
'kahvila' => \__( 'Café', 'tms-theme-base' ),
'kauppa' => \__( 'Shop', 'tms-theme-base' ),
'kokoustilaa' => \__( 'Meeting room', 'tms-theme-base' ),
'lainattavia-valineita' => \__( 'Assistive device lending', 'tms-theme-base' ),
'lastenhoitotila' => \__( 'Baby changing', 'tms-theme-base' ),
'latauspiste' => \__( 'Charging point', 'tms-theme-base' ),
'lipunmyynti' => \__( 'Ticket sales', 'tms-theme-base' ),
'luiska' => \__( 'Ramp', 'tms-theme-base' ),
'nakovammaisia_helpottavat_palvelut' => \__( 'Services for the visually impaired', 'tms-theme-base' ),
'opaskoirat_sallittu' => \__( 'Service dogs allowed', 'tms-theme-base' ),
'pistekirjoitus' => \__( 'Braille', 'tms-theme-base' ),
'porrashissi' => \__( 'Stairlift', 'tms-theme-base' ),
'portaat' => \__( 'Staircase', 'tms-theme-base' ),
'pyoratuolihissi' => \__( 'Platform lift', 'tms-theme-base' ),
'rollaattori' => \__( 'Rollator, walker', 'tms-theme-base' ),
'sahkomopon_sailytys' => \__( 'Electric mobility scooter storage', 'tms-theme-base' ),
'sailytyslokerot' => \__( 'Lockers', 'tms-theme-base' ),
'suuri_teksti' => \__( 'Large print', 'tms-theme-base' ),
'vaatesailytys' => \__( 'Cloakroom', 'tms-theme-base' ),
'viitomakielinen_palvelu' => \__( 'Sign-language services', 'tms-theme-base' ),
'wc_oikea' => \__( 'Accessible toilet: one-sided access', 'tms-theme-base' ),
'wc_vasen' => \__( 'Accessible toilet: one-sided access', 'tms-theme-base' ),
'wc' => \__( 'WC', 'tms-theme-base' ),
];
}
}
Loading