From c55e0cf1fa5bf14e6851c7926493fd07aeaf4545 Mon Sep 17 00:00:00 2001 From: clemdesign Date: Wed, 17 Oct 2018 09:04:39 +0200 Subject: [PATCH 1/2] Fix issue #6 --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bfbacc0..2447e77 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,20 @@ This will clone this repository into the _language-selector_ folder. # Usage -The `Language Selector` plugin doesn't require any configuration. You do however need to add the included Twig partials template into your own theme somewhere you want the available languages to be displayed. +## 1. Define the supported languages + +In `system.yaml`, add the supported languages in `languages.supported` parameter. + +Example: + + languages: + supported: + - fr + - en + +## 2. Integration + +You do need to add the included Twig partials template into your own theme somewhere you want the available languages to be displayed. ``` {% include 'partials/language-selector.html.twig' %} @@ -54,7 +67,7 @@ You can now edit the override and tweak it however you prefer. `language-selector` need jQuery to display dropdown language menu. -## Usage of the `hreflang` partial +## 3. Usage of the `hreflang` partial A second template is available for `hreflang` annotations in the header of the page. In order to emit language annotations for the available languages of a page you need to add the corrsponding Twig partial template into the `` section of your page, which can typically be found in `base.html.twig`: From 31d27db0818d9b70f609cab70611aec3b91f2e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ko=CC=88rber?= Date: Thu, 22 Nov 2018 18:19:39 +0100 Subject: [PATCH 2/2] Replaced .andSelf() function which was removed in jQuery 3.0: https://api.jquery.com/andself/ --- js/language-selector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/language-selector.js b/js/language-selector.js index b6aae7a..c16da47 100644 --- a/js/language-selector.js +++ b/js/language-selector.js @@ -51,7 +51,7 @@ var dropdownmenu={ if (this.builtdropdownids.length === 0){ //only bind click event to document once $(document).bind("click", function(e){ if (e.button === 0){ //hide all dropdown (and their sub ULs) when left mouse button is clicked - $('.jqdropdown').find('ul').andSelf().hide() + $('.jqdropdown').find('ul').addBack().hide() } }) }