From 026a54717eb699f8c47d2034940a65da1dd24746 Mon Sep 17 00:00:00 2001 From: Sonvir Date: Wed, 13 Nov 2024 19:01:49 +0530 Subject: [PATCH 1/4] Issue-490: Fixes Featured content missing on Arabic. (#751) Co-authored-by: sonvir249 <39142-sonvir249@users.noreply.drupalcode.org> --- .../src/ElementTrait/CarouselTrait.php | 3 ++ .../custom/server_theme/server_theme.theme | 2 + .../server-theme-carousel-base.html.twig | 38 ++++++++++--------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/web/modules/custom/server_general/src/ElementTrait/CarouselTrait.php b/web/modules/custom/server_general/src/ElementTrait/CarouselTrait.php index 85dcae14a..3edc17ca7 100644 --- a/web/modules/custom/server_general/src/ElementTrait/CarouselTrait.php +++ b/web/modules/custom/server_general/src/ElementTrait/CarouselTrait.php @@ -41,12 +41,15 @@ protected function buildElementCarousel(string $title, array $body, array $items return []; } + $current_lang_code = \Drupal::languageManager()->getCurrentLanguage(); + $elements = []; $elements[] = [ '#theme' => 'server_theme_carousel', '#items' => $items, '#is_featured' => $is_featured, '#is_infinite' => $is_infinite, + '#direction' => $current_lang_code->getDirection(), ]; if ($button) { diff --git a/web/themes/custom/server_theme/server_theme.theme b/web/themes/custom/server_theme/server_theme.theme index 64e2bc068..38737b20d 100644 --- a/web/themes/custom/server_theme/server_theme.theme +++ b/web/themes/custom/server_theme/server_theme.theme @@ -304,6 +304,8 @@ function server_theme_theme() { 'is_infinite' => FALSE, // The render array of `server_theme_button`. 'button' => NULL, + // Indicates the carousel direction. + 'direction' => NULL, ], ]; diff --git a/web/themes/custom/server_theme/templates/server-theme-carousel-base.html.twig b/web/themes/custom/server_theme/templates/server-theme-carousel-base.html.twig index 1b78c0d47..1f9f5c31a 100644 --- a/web/themes/custom/server_theme/templates/server-theme-carousel-base.html.twig +++ b/web/themes/custom/server_theme/templates/server-theme-carousel-base.html.twig @@ -1,22 +1,24 @@ {{ attach_library('server_theme/slick') }} {% if items is not empty %} -