Skip to content

Commit

Permalink
Issue-490: Fixes Featured content missing on Arabic. (#751)
Browse files Browse the repository at this point in the history
Co-authored-by: sonvir249 <[email protected]>
  • Loading branch information
sonvir249 and sonvir249 authored Nov 13, 2024
1 parent 19ffe87 commit 026a547
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions web/themes/custom/server_theme/server_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{{ attach_library('server_theme/slick') }}
{% if items is not empty %}
<div class="carousel-wrapper"
data-carousel-infinite="{{ is_infinite ? 'true' : 'false' }}"
data-carousel-dots="{{ dots ? 'true' : 'false' }}"
data-carousel-arrows="{{ arrows ? 'true' : 'false' }}"
data-carousel-fixed-width-on-mobile="{{ fixed_width_on_mobile ? 'true' : 'false' }}"
data-carousel-center-mode-mobile="{{ center_mode_mobile ? 'true' : 'false' }}"
data-carousel-responsive="{{ responsive ?? 'true' }}"
data-carousel-single-slide="{{ single_slide ? 'true' : 'false' }}"
data-slides-to-scroll="{{ slides_to_scroll|default('1') }}"
{% if slides_laptop %}data-slides-laptop="{{ slides_laptop }}"{% endif %}
{% if slides_tablet %}data-slides-tablet="{{ slides_tablet }}"{% endif %}
{% if slides_desktop %}data-slides-desktop="{{ slides_desktop }}"{% endif %}
>
{% for item in items %}
<div class="carousel-slide sm:mx-3">
{{- item -}}
</div>
{% endfor %}
<div dir="{{ direction }}">
<div class="carousel-wrapper"
data-carousel-infinite="{{ is_infinite ? 'true' : 'false' }}"
data-carousel-dots="{{ dots ? 'true' : 'false' }}"
data-carousel-arrows="{{ arrows ? 'true' : 'false' }}"
data-carousel-fixed-width-on-mobile="{{ fixed_width_on_mobile ? 'true' : 'false' }}"
data-carousel-center-mode-mobile="{{ center_mode_mobile ? 'true' : 'false' }}"
data-carousel-responsive="{{ responsive ?? 'true' }}"
data-carousel-single-slide="{{ single_slide ? 'true' : 'false' }}"
data-slides-to-scroll="{{ slides_to_scroll|default('1') }}"
{% if slides_laptop %}data-slides-laptop="{{ slides_laptop }}"{% endif %}
{% if slides_tablet %}data-slides-tablet="{{ slides_tablet }}"{% endif %}
{% if slides_desktop %}data-slides-desktop="{{ slides_desktop }}"{% endif %}
>
{% for item in items %}
<div class="carousel-slide sm:mx-3">
{{- item -}}
</div>
{% endfor %}
</div>
</div>
{% endif %}

0 comments on commit 026a547

Please sign in to comment.