public function LanguageDropdownBlock::blockSubmit in Language Switcher Dropdown 8.2
Overrides BlockPluginTrait::blockSubmit
File
- src/
Plugin/ Block/ LanguageDropdownBlock.php, line 635
Class
- LanguageDropdownBlock
- Provides a 'Language dropdown switcher' block.
Namespace
Drupal\lang_dropdown\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
/** @var array[][] $lang_dropdown */
$lang_dropdown = $form_state
->getValue('lang_dropdown');
$this->configuration['showall'] = $lang_dropdown['showall'];
$this->configuration['tohome'] = $lang_dropdown['tohome'];
$this->configuration['width'] = $lang_dropdown['width'];
$this->configuration['display'] = $lang_dropdown['display'];
$this->configuration['widget'] = $lang_dropdown['widget'];
$this->configuration['msdropdown'] = [
'visible_rows' => $lang_dropdown['msdropdown']['visible_rows'],
'rounded' => $lang_dropdown['msdropdown']['rounded'],
'animation' => $lang_dropdown['msdropdown']['animation'],
'event' => $lang_dropdown['msdropdown']['event'],
'skin' => $lang_dropdown['msdropdown']['skin'],
'custom_skin' => $lang_dropdown['msdropdown']['custom_skin'],
];
$this->configuration['chosen'] = [
'disable_search' => $lang_dropdown['chosen']['disable_search'],
'no_results_text' => $lang_dropdown['chosen']['no_results_text'],
];
$this->configuration['ddslick'] = [
'ddslick_height' => $lang_dropdown['ddslick']['ddslick_height'],
'showSelectedHTML' => $lang_dropdown['ddslick']['showSelectedHTML'],
'imagePosition' => $lang_dropdown['ddslick']['imagePosition'],
'skin' => $lang_dropdown['ddslick']['skin'],
'custom_skin' => $lang_dropdown['ddslick']['custom_skin'],
];
$this->configuration['languageicons'] = [
'flag_position' => $lang_dropdown['languageicons']['flag_position'],
];
$this->configuration['hidden_languages'] = [];
/** @var string $code */
/** @var array $values */
if (isset($lang_dropdown['hideout']['languages']) && is_array($lang_dropdown['hideout']['languages'])) {
foreach ($lang_dropdown['hideout']['languages'] as $code => $values) {
unset($values['language']);
foreach ($values as $rid => $value) {
if ($value) {
$this->configuration['hidden_languages'][$rid][] = $code;
}
}
}
}
}