diff --git a/css/module/google_currency_converter.module.css b/css/module/google_currency_converter.module.css new file mode 100644 index 0000000..c7b5d7c --- /dev/null +++ b/css/module/google_currency_converter.module.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..20d555e --- /dev/null +++ b/google_currency_converter.libraries.yml @@ -0,0 +1,5 @@ +drupal.google_currency_converter: + version: VERSION + css: + component: + css/google_currency_converter.module.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 fbcadc9..1ead9b0 100644 --- a/src/Plugin/Block/GoogleCurrencyConverterBlock.php +++ b/src/Plugin/Block/GoogleCurrencyConverterBlock.php @@ -111,11 +111,11 @@ class GoogleCurrencyConverterBlock extends BlockBase implements ContainerFactory public function build() { $config = $this->getConfiguration(); - $render = []; $form = $this->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['google_currency_converter_form'] = $form; + $render['block'] = $form; + $render['block']['#attached']['library'] = ['google_currency_converter/drupal.google_currency_converter']; return $render; }