diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 644ec57..fba5d09 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1605,6 +1605,13 @@ function install_select_language_form($form, &$form_state, $files = array()) { } $browser_langcode = language_from_browser($browser_options); + + $form['langcode_search'] = array( + '#type' => 'textfield', + '#default_value' => $select_options[$browser_langcode], + '#placeholder' => t('Search Language'), + ); + $form['langcode'] = array( '#type' => 'select', '#title' => t('Choose language'), @@ -1612,6 +1619,7 @@ function install_select_language_form($form, &$form_state, $files = array()) { '#options' => $select_options, // Use the browser detected language as default or English if nothing found. '#default_value' => !empty($browser_langcode) ? $browser_langcode : 'en', + '#attributes' => array('size' => 8), ); if (empty($files)) { diff --git a/core/themes/seven/images/search-button.png b/core/themes/seven/images/search-button.png new file mode 100644 index 0000000..c6e820a --- /dev/null +++ b/core/themes/seven/images/search-button.png @@ -0,0 +1,4 @@ +PNG + + IHDR"0Q2IDAT8O}KAoK*ƈ) +Z-$%^BŃ`P[= "t]v6,fΛ7%WUAމ* HJd&ӒK$DKX1@D{kkm1-Ebp-U*sKG,'ss{w~W_l(ڙg77NJAղs0D,X)Q|ZZ ,|,p;(}"E$ (NfzV:?_-?x=HR vxy5C1o XBF*'`RݟF;nS=u_D}/8;>Q<]r]ELn⪀]$ud&ӒK8XuR@DC[͖"68wg&&gviNtyxجLxdbHmo^߰U)P<ѹN f@6Q+ꚦjW-h[uRDLӴLxmbZ19D.ޛ(.Xa8ekO&W/nAxdzA0JYrEs:wݺ6z,M>!:ωt:Z^(qvhTl4Y#IENDB` \ No newline at end of file diff --git a/core/themes/seven/install-page.css b/core/themes/seven/install-page.css index 0d223f0..7338787 100644 --- a/core/themes/seven/install-page.css +++ b/core/themes/seven/install-page.css @@ -186,3 +186,17 @@ body.install-page #page-title { width: auto; } } +.install-select-language-form input.form-text { + background-image: url('images/search-button.png'); + background-repeat: no-repeat; + background-position: right 0px; + border-radius: 3px; + padding: 5px; + width: 100%; +} +.install-select-language-form select.form-select { + border-radius: 3px; + padding: 5px; + width: 100%; + line-height: 160px; +} diff --git a/core/themes/seven/js/install.js b/core/themes/seven/js/install.js new file mode 100644 index 0000000..d90745f --- /dev/null +++ b/core/themes/seven/js/install.js @@ -0,0 +1,24 @@ +(function ($, Drupal) { + + "use strict"; + + // Find the select option that matches the search string the closest and + // select it. + Drupal.behaviors.LangcodeSearch = { + attach: function (context) { + var $form = $('#install-select-language-form'); + var $search = $form.find('input.form-text[name="langcode_search"]'), $select = $form.find('select[name="langcode"]'); + + $search.on('keyup', function(){ + var $this = $(this), r = new RegExp($this.val(), 'i'); + + var $searched = $select.find('option').filter(function(){ + return $(this).text().match(r); + }); + + $select.val($searched.val()); + }); + } + }; + +})(jQuery, Drupal); diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 819db34..1668486 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -16,6 +16,9 @@ function seven_library_info() { $libraries['install-page'] = array( 'version' => \Drupal::VERSION, 'js' => array( + $path . '/js/install.js' => array( + 'group' => JS_THEME, + ), $path . '/js/mobile.install.js' => array( 'group' => JS_THEME, ), @@ -25,6 +28,10 @@ function seven_library_info() { 'group' => CSS_AGGREGATE_THEME, ), ), + 'dependencies' => array( + array('system', 'jquery'), + array('system', 'drupal'), + ), ); return $libraries;