upgrades core to 8.4.2

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-14 16:09:54 +01:00
parent bd60eff9b3
commit c2b4e25be4
3504 changed files with 140306 additions and 38684 deletions
@@ -2,6 +2,7 @@
namespace Drupal\language\EventSubscriber;
use Drupal\Core\DrupalKernelInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
use Drupal\language\ConfigurableLanguageManagerInterface;
@@ -51,7 +52,7 @@ class LanguageRequestSubscriber implements EventSubscriberInterface {
* The language manager service.
* @param \Drupal\language\LanguageNegotiatorInterface $negotiator
* The language negotiator.
* @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation;
* @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation
* The translation service.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current active user.
@@ -64,25 +65,39 @@ class LanguageRequestSubscriber implements EventSubscriberInterface {
}
/**
* Sets the default language and initializes configuration overrides.
* Initializes the language manager at the beginning of the request.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* The Event to process.
*/
public function onKernelRequestLanguage(GetResponseEvent $event) {
if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
$this->negotiator->setCurrentUser($this->currentUser);
if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) {
$this->languageManager->setNegotiator($this->negotiator);
$this->languageManager->setConfigOverrideLanguage($this->languageManager->getCurrentLanguage());
}
// After the language manager has initialized, set the default langcode
// for the string translations.
$langcode = $this->languageManager->getCurrentLanguage()->getId();
$this->translation->setDefaultLangcode($langcode);
$this->setLanguageOverrides();
}
}
/**
* Initializes config overrides whenever the service container is rebuilt.
*/
public function onContainerInitializeSubrequestFinished() {
$this->setLanguageOverrides();
}
/**
* Sets the language for config overrides on the language manager.
*/
private function setLanguageOverrides() {
$this->negotiator->setCurrentUser($this->currentUser);
if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) {
$this->languageManager->setNegotiator($this->negotiator);
$this->languageManager->setConfigOverrideLanguage($this->languageManager->getCurrentLanguage());
}
// After the language manager has initialized, set the default langcode for
// the string translations.
$langcode = $this->languageManager->getCurrentLanguage()->getId();
$this->translation->setDefaultLangcode($langcode);
}
/**
* Registers the methods in this class that should be listeners.
*
@@ -91,6 +106,7 @@ class LanguageRequestSubscriber implements EventSubscriberInterface {
*/
public static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = ['onKernelRequestLanguage', 255];
$events[DrupalKernelInterface::CONTAINER_INITIALIZE_SUBREQUEST_FINISHED][] = ['onContainerInitializeSubrequestFinished', 255];
return $events;
}
@@ -23,11 +23,8 @@ class NegotiationBrowserForm extends ConfigFormBase {
/**
* {@inheritdoc}
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler
*/
public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager ) {
public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager) {
parent::__construct($config_factory);
$this->languageManager = $language_manager;
}
@@ -147,7 +147,7 @@ class PathProcessorLanguage implements InboundPathProcessorInterface, OutboundPa
// Sort the processors list, so that their functions are called in the
// order specified by the weight of the methods.
uksort($this->processors[$scope], function ($method_id_a, $method_id_b) use($weights) {
uksort($this->processors[$scope], function ($method_id_a, $method_id_b) use ($weights) {
$a_weight = $weights[$method_id_a];
$b_weight = $weights[$method_id_b];
@@ -24,7 +24,7 @@ interface LanguageNegotiationMethodInterface {
/**
* Injects the configuration factory.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* The configuration factory.
*/
public function setConfig(ConfigFactoryInterface $config);
@@ -74,7 +74,7 @@ class LanguageNegotiator implements LanguageNegotiatorInterface {
* Constructs a new LanguageNegotiator object.
*
* @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
* The language manager.
* The language manager.
* @param \Drupal\Component\Plugin\PluginManagerInterface $negotiator_manager
* The language negotiation methods plugin manager
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
@@ -91,7 +91,6 @@ use Drupal\Core\Session\AccountInterface;
* }
* }
* }
* ?>
* @endcode
*
* For more information, see
@@ -70,7 +70,7 @@ class LanguageServiceProvider extends ServiceProviderBase {
// and caching. This might prove difficult as this is called before the
// container has finished building.
$config_storage = BootstrapConfigStorageFactory::get();
$config_ids = array_filter($config_storage->listAll($prefix), function($config_id) use ($prefix) {
$config_ids = array_filter($config_storage->listAll($prefix), function ($config_id) use ($prefix) {
return $config_id != $prefix . LanguageInterface::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . LanguageInterface::LANGCODE_NOT_APPLICABLE;
});
return count($config_ids) > 1;
@@ -104,7 +104,7 @@ class Language extends ConditionPluginBase implements ContainerFactoryPluginInte
$language_list = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL);
$selected = $this->configuration['langcodes'];
// Reduce the language list to an array of language names.
$language_names = array_reduce($language_list, function(&$result, $item) use ($selected) {
$language_names = array_reduce($language_list, function (&$result, $item) use ($selected) {
// If the current item of the $language_list array is one of the selected
// languages, add it to the $results array.
if (!empty($selected[$item->getId()])) {
@@ -8,7 +8,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
/**
* @MigrateSource(
* id = "language",
* source_provider = "locale"
* source_module = "locale"
* )
*/
class Language extends DrupalSqlBase {
@@ -10,6 +10,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
*
* @MigrateSource(
* id = "d6_language_content_settings",
* source_module = "locale"
* )
*/
class LanguageContentSettings extends DrupalSqlBase {
@@ -10,6 +10,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
*
* @MigrateSource(
* id = "d7_language_content_settings",
* source_module = "locale"
* )
*/
class LanguageContentSettings extends DrupalSqlBase {