updated core to 8.6.1 via composer
This commit is contained in:
@@ -16,6 +16,13 @@ use Drupal\language\ConfigurableLanguageInterface;
|
||||
* @ConfigEntityType(
|
||||
* id = "configurable_language",
|
||||
* label = @Translation("Language"),
|
||||
* label_collection = @Translation("Languages"),
|
||||
* label_singular = @Translation("language"),
|
||||
* label_plural = @Translation("languages"),
|
||||
* label_count = @PluralTranslation(
|
||||
* singular = "@count language",
|
||||
* plural = "@count languages",
|
||||
* ),
|
||||
* handlers = {
|
||||
* "list_builder" = "Drupal\language\LanguageListBuilder",
|
||||
* "access" = "Drupal\language\LanguageAccessControlHandler",
|
||||
@@ -139,6 +146,14 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu
|
||||
// Install any available language configuration overrides for the language.
|
||||
\Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id());
|
||||
}
|
||||
|
||||
if (!$this->isLocked() && !$update) {
|
||||
// Add language to the list of language domains.
|
||||
$config = \Drupal::configFactory()->getEditable('language.negotiation');
|
||||
$domains = $config->get('url.domains');
|
||||
$domains[$this->id()] = '';
|
||||
$config->set('url.domains', $domains)->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,6 +188,12 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu
|
||||
if (!\Drupal::languageManager()->isMultilingual()) {
|
||||
ConfigurableLanguageManager::rebuildServices();
|
||||
}
|
||||
|
||||
// Remove language from language prefix and domain list.
|
||||
$config = \Drupal::configFactory()->getEditable('language.negotiation');
|
||||
$config->clear('url.prefixes.' . $entity->id());
|
||||
$config->clear('url.domains.' . $entity->id());
|
||||
$config->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,13 @@ use Drupal\language\ContentLanguageSettingsInterface;
|
||||
* @ConfigEntityType(
|
||||
* id = "language_content_settings",
|
||||
* label = @Translation("Content Language Settings"),
|
||||
* label_collection = @Translation("Content Language Settings"),
|
||||
* label_singular = @Translation("content language setting"),
|
||||
* label_plural = @Translation("content languages settings"),
|
||||
* label_count = @PluralTranslation(
|
||||
* singular = "@count content language setting",
|
||||
* plural = "@count content languages settings",
|
||||
* ),
|
||||
* admin_permission = "administer languages",
|
||||
* config_prefix = "content_settings",
|
||||
* entity_keys = {
|
||||
|
||||
@@ -34,7 +34,7 @@ class LanguageRequestSubscriber implements EventSubscriberInterface {
|
||||
/**
|
||||
* The translation service.
|
||||
*
|
||||
* @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface;
|
||||
* @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface
|
||||
*/
|
||||
protected $translation;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ class ContentLanguageSettingsForm extends FormBase {
|
||||
->save();
|
||||
}
|
||||
}
|
||||
drupal_set_message($this->t('Settings successfully updated.'));
|
||||
$this->messenger()->addStatus($this->t('Settings successfully updated.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@ class LanguageAddForm extends LanguageFormBase {
|
||||
|
||||
$t_args = ['%language' => $this->entity->label(), '%langcode' => $this->entity->id()];
|
||||
$this->logger('language')->notice('The %language (%langcode) language has been created.', $t_args);
|
||||
drupal_set_message($this->t('The language %language has been created and can now be used.', $t_args));
|
||||
$this->messenger()->addStatus($this->t('The language %language has been created and can now be used.', $t_args));
|
||||
|
||||
if ($this->moduleHandler->moduleExists('block')) {
|
||||
// Tell the user they have the option to add a language switcher block
|
||||
// to their theme so they can switch between the languages.
|
||||
drupal_set_message($this->t('Use one of the language switcher blocks to allow site visitors to switch between languages. You can enable these blocks on the <a href=":block-admin">block administration page</a>.', [':block-admin' => $this->url('block.admin_display')]));
|
||||
$this->messenger()->addStatus($this->t('Use one of the language switcher blocks to allow site visitors to switch between languages. You can enable these blocks on the <a href=":block-admin">block administration page</a>.', [':block-admin' => $this->url('block.admin_display')]));
|
||||
}
|
||||
$form_state->setRedirectUrl($this->entity->urlInfo('collection'));
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ abstract class LanguageFormBase extends EntityForm {
|
||||
$form['langcode_view'] = [
|
||||
'#type' => 'item',
|
||||
'#title' => $this->t('Language code'),
|
||||
'#markup' => $language->id()
|
||||
'#markup' => $language->id(),
|
||||
];
|
||||
$form['langcode'] = [
|
||||
'#type' => 'value',
|
||||
'#value' => $language->id()
|
||||
'#value' => $language->id(),
|
||||
];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -29,7 +29,6 @@ class NegotiationBrowserDeleteForm extends ConfirmFormBase {
|
||||
return ['language.mappings'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -76,7 +75,7 @@ class NegotiationBrowserDeleteForm extends ConfirmFormBase {
|
||||
|
||||
$this->logger('language')->notice('The browser language detection mapping for the %browser browser language code has been deleted.', $args);
|
||||
|
||||
drupal_set_message($this->t('The mapping for the %browser browser language code has been deleted.', $args));
|
||||
$this->messenger()->addStatus($this->t('The mapping for the %browser browser language code has been deleted.', $args));
|
||||
|
||||
$form_state->setRedirect('language.negotiation_browser');
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Drupal\language\Form;
|
||||
|
||||
use Drupal\Core\Block\BlockManagerInterface;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
||||
@@ -204,7 +203,7 @@ class NegotiationConfigureForm extends ConfigFormBase {
|
||||
$this->blockManager->clearCachedDefinitions();
|
||||
|
||||
$form_state->setRedirect('language.negotiation');
|
||||
drupal_set_message($this->t('Language detection configuration saved.'));
|
||||
$this->messenger()->addStatus($this->t('Language detection configuration saved.'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,7 +235,7 @@ class NegotiationConfigureForm extends ConfigFormBase {
|
||||
'#attributes' => ['class' => ['language-customization-checkbox']],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'language/drupal.language.admin'
|
||||
'language/drupal.language.admin',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -276,7 +275,7 @@ class NegotiationConfigureForm extends ConfigFormBase {
|
||||
|
||||
$table_form['weight'][$method_id] = [
|
||||
'#type' => 'weight',
|
||||
'#title' => $this->t('Weight for @title language detection method', ['@title' => Unicode::strtolower($method_name)]),
|
||||
'#title' => $this->t('Weight for @title language detection method', ['@title' => mb_strtolower($method_name)]),
|
||||
'#title_display' => 'invisible',
|
||||
'#default_value' => $weight,
|
||||
'#attributes' => ['class' => ["language-method-weight-$type"]],
|
||||
@@ -287,7 +286,7 @@ class NegotiationConfigureForm extends ConfigFormBase {
|
||||
|
||||
$table_form['enabled'][$method_id] = [
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Enable @title language detection method', ['@title' => Unicode::strtolower($method_name)]),
|
||||
'#title' => $this->t('Enable @title language detection method', ['@title' => mb_strtolower($method_name)]),
|
||||
'#title_display' => 'invisible',
|
||||
'#default_value' => $enabled,
|
||||
];
|
||||
|
||||
@@ -60,7 +60,6 @@ class PathProcessorLanguage implements InboundPathProcessorInterface, OutboundPa
|
||||
*/
|
||||
protected $configSubscriber;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a PathProcessorLanguage object.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\Core\Messenger\MessengerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,13 @@ class LanguageListBuilder extends DraggableListBuilder {
|
||||
*/
|
||||
protected $configFactory;
|
||||
|
||||
/**
|
||||
* The messenger.
|
||||
*
|
||||
* @var \Drupal\Core\Messenger\MessengerInterface
|
||||
*/
|
||||
protected $messenger;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -45,7 +53,8 @@ class LanguageListBuilder extends DraggableListBuilder {
|
||||
$entity_type,
|
||||
$container->get('entity.manager')->getStorage($entity_type->id()),
|
||||
$container->get('language_manager'),
|
||||
$container->get('config.factory')
|
||||
$container->get('config.factory'),
|
||||
$container->get('messenger')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,11 +69,14 @@ class LanguageListBuilder extends DraggableListBuilder {
|
||||
* The language manager.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
* The factory for configuration objects.
|
||||
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
|
||||
* The messenger.
|
||||
*/
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) {
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, MessengerInterface $messenger) {
|
||||
parent::__construct($entity_type, $storage);
|
||||
$this->languageManager = $language_manager;
|
||||
$this->configFactory = $config_factory;
|
||||
$this->messenger = $messenger;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +166,7 @@ class LanguageListBuilder extends DraggableListBuilder {
|
||||
$this->languageManager->updateLockedLanguageWeights();
|
||||
}
|
||||
|
||||
drupal_set_message(t('Configuration saved.'));
|
||||
$this->messenger->addStatus($this->t('Configuration saved.'));
|
||||
// Force the redirection to the page with the language we have just
|
||||
// selected as default.
|
||||
$form_state->setRedirectUrl($this->entities[$new_id]->urlInfo('collection', ['language' => $this->entities[$new_id]]));
|
||||
|
||||
@@ -57,7 +57,6 @@ class LanguageBlock extends BlockBase implements ContainerFactoryPluginInterface
|
||||
$this->pathMatcher = $path_matcher;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -71,7 +70,6 @@ class LanguageBlock extends BlockBase implements ContainerFactoryPluginInterface
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ class LanguageDomains extends ArrayBuild {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
if ($row->getSourceProperty('domain_negotiation')) {
|
||||
if ($row->getSourceProperty('domain_negotiation_used')) {
|
||||
global $base_url;
|
||||
|
||||
foreach ($value as $old_key => $old_value) {
|
||||
|
||||
@@ -66,7 +66,7 @@ class Language extends DrupalSqlBase {
|
||||
// when the 'language_negotiation' variable is set to '3', and in D7, when
|
||||
// the 'locale_language_negotiation_url_part' variable is set to '1'.
|
||||
if ($this->variableGet('language_negotiation', 0) == 3 || $this->variableGet('locale_language_negotiation_url_part', 0) == 1) {
|
||||
$row->setSourceProperty('domain_negotiation', TRUE);
|
||||
$row->setSourceProperty('domain_negotiation_used', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user