Skip to content

Commit

Permalink
pkp/pkp-lib#9262 Add swiper.js carousel to default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and asmecher committed Oct 11, 2023
1 parent 880282e commit e1df5d6
Show file tree
Hide file tree
Showing 11 changed files with 10,058 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plugins/themes/default/DefaultThemePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ public function init()
$this->addScript('bsUtil', 'js/lib/bootstrap/util.js');
$this->addScript('bsDropdown', 'js/lib/bootstrap/dropdown.js');

// Load Swiper for carousel
$this->addScript('swiper', 'js/lib/swiper/swiper-bundle' . $min . '.js');
$this->addStyle('swiper', 'js/lib/swiper/swiper-bundle' . $min . '.css');
$this->addScript('swiper-i18n', $this->getSwiperI18n(), ['inline' => true]);

// Load custom JavaScript for this theme
$this->addScript('default', 'js/main.js');

Expand Down Expand Up @@ -256,6 +261,17 @@ public function getDescription()
{
return __('plugins.themes.default.description');
}

/**
* Get the locale strings for the swiper carousel
*/
public function getSwiperI18n(): string
{
return 'var pkpDefaultThemeI18N = ' . json_encode([
'nextSlide' => __('plugins.themes.default.nextSlide'),
'prevSlide' => __('plugins.themes.default.prevSlide'),
]);
}
}

if (!PKP_STRICT_MODE) {
Expand Down
Loading

0 comments on commit e1df5d6

Please sign in to comment.