diff --git a/css/google_currency_converter.css b/css/google_currency_converter.css new file mode 100644 index 0000000..11b8b23 --- /dev/null +++ b/css/google_currency_converter.css @@ -0,0 +1,3 @@ +.gcc-select-list { + width: 250px; +} diff --git a/google_currency_converter.libraries.yml b/google_currency_converter.libraries.yml new file mode 100644 index 0000000..01edf9b --- /dev/null +++ b/google_currency_converter.libraries.yml @@ -0,0 +1,4 @@ +gcc: + css: + theme: + css/google_currency_converter.css: {} diff --git a/src/Form/GoogleCurrencyConverterForm.php b/src/Form/GoogleCurrencyConverterForm.php index d0d6d1f..b59823b 100644 --- a/src/Form/GoogleCurrencyConverterForm.php +++ b/src/Form/GoogleCurrencyConverterForm.php @@ -55,6 +55,7 @@ class GoogleCurrencyConverterForm extends FormBase { '#title' => t('Select Your Currency From'), '#options' => $this->googleCurrencyConveter->countries(), '#default_value' => '', + '#attributes' => array('class' => array('gcc-select-list')), '#required' => TRUE, ); $form['google_currency_converter_to'] = array( @@ -62,6 +63,7 @@ class GoogleCurrencyConverterForm extends FormBase { '#title' => t('Select Your Currency To'), '#options' => $this->googleCurrencyConveter->countries(), '#default_value' => '', + '#attributes' => array('class' => array('gcc-select-list')), '#required' => TRUE, ); $form['amount'] = array( diff --git a/src/Plugin/Block/GoogleCurrencyConverterBlock.php b/src/Plugin/Block/GoogleCurrencyConverterBlock.php index 1f181dc..cdac8e1 100644 --- a/src/Plugin/Block/GoogleCurrencyConverterBlock.php +++ b/src/Plugin/Block/GoogleCurrencyConverterBlock.php @@ -103,6 +103,7 @@ class GoogleCurrencyConverterBlock extends BlockBase implements ContainerFactory $form = \Drupal::formBuilder()->getForm('Drupal\google_currency_converter\Form\GoogleCurrencyConverterForm'); $form['google_currency_converter_from']['#default_value'] = $config['google_currency_converter_from']; $form['google_currency_converter_to']['#default_value'] = $config['google_currency_converter_to']; + $render[]['#attached']['library'][] = 'google_currency_converter/gcc'; $render['google_currency_converter_form'] = $form; return $render; }