diff --git a/core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php b/core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php index 5279dd6..d5a1c05 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php +++ b/core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php @@ -52,4 +52,20 @@ public function build() { return $build; } + /** + * {@inheritdoc} + */ + public function blockForm($form, &$form_state) { + $form = parent::blockForm($form, $form_state); + $path = drupal_is_front_page() ? '' : current_path(); + list(, $type) = explode(':', $this->getPluginId()); + $links = language_negotiation_get_switch_links($type, $path); + // Warn the user that if there are no links to show, the block won't appear. + if (empty($links)) { + drupal_set_message($this->t('You do not have any language detection method enabled that provide URL based detection. The language switcher module will not be shown.'), 'warning'); + } + + return $form; + } + }