Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -136,7 +136,7 @@ class NegotiationUrlForm extends ConfigFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::validateForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
$languages = $this->languageManager->getLanguages();
|
||||
|
|
|
@ -144,9 +144,9 @@ class LanguageNegotiationSession extends LanguageNegotiationMethodBase implement
|
|||
foreach ($this->languageManager->getNativeLanguages() as $language) {
|
||||
$langcode = $language->getId();
|
||||
$links[$langcode] = array(
|
||||
// We need to clone the $url object to avoid using the same one for all links.
|
||||
// When the links are rendered, options are set on the $url object,
|
||||
// so if we use the same one, they would be set for all links.
|
||||
// We need to clone the $url object to avoid using the same one for all
|
||||
// links. When the links are rendered, options are set on the $url
|
||||
// object, so if we use the same one, they would be set for all links.
|
||||
'url' => clone $url,
|
||||
'title' => $language->getName(),
|
||||
'attributes' => array('class' => array('language-link')),
|
||||
|
|
|
@ -101,7 +101,7 @@ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements In
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processInbound($path, Request $request) {
|
||||
$config = $this->config->get('language.negotiation')->get('url');
|
||||
|
@ -121,7 +121,7 @@ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements In
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processOutbound().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
|
||||
$url_scheme = 'http';
|
||||
|
@ -200,9 +200,9 @@ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements In
|
|||
|
||||
foreach ($this->languageManager->getNativeLanguages() as $language) {
|
||||
$links[$language->getId()] = array(
|
||||
// We need to clone the $url object to avoid using the same one for all links.
|
||||
// When the links are rendered, options are set on the $url object,
|
||||
// so if we use the same one, they would be set for all links.
|
||||
// We need to clone the $url object to avoid using the same one for all
|
||||
// links. When the links are rendered, options are set on the $url
|
||||
// object, so if we use the same one, they would be set for all links.
|
||||
'url' => clone $url,
|
||||
'title' => $language->getName(),
|
||||
'language' => $language,
|
||||
|
|
57
core/modules/language/src/Plugin/migrate/source/Language.php
Normal file
57
core/modules/language/src/Plugin/migrate/source/Language.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\language\Plugin\migrate\source\Language.
|
||||
*/
|
||||
|
||||
namespace Drupal\language\Plugin\migrate\source;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* @MigrateSource(
|
||||
* id = "language",
|
||||
* source_provider = "locale"
|
||||
* )
|
||||
*/
|
||||
class Language extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array(
|
||||
'language' => $this->t('The language code.'),
|
||||
'name' => $this->t('The English name of the language.'),
|
||||
'native' => $this->t('The native name of the language.'),
|
||||
'direction' => $this->t('The language direction. (0 = LTR, 1 = RTL)'),
|
||||
'enabled' => $this->t('Whether the language is enabled.'),
|
||||
'plurals' => $this->t('Number of plural indexes in this language.'),
|
||||
'formula' => $this->t('PHP formula to get plural indexes.'),
|
||||
'domain' => $this->t('Domain to use for this language.'),
|
||||
'prefix' => $this->t('Path prefix used for this language.'),
|
||||
'weight' => $this->t('The language weight when listed.'),
|
||||
'javascript' => $this->t('Location of the JavaScript translation file.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
return array(
|
||||
'language' => array(
|
||||
'type' => 'string',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
return $this->select('languages')->fields('languages');
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\language\ProxyClass\LanguageConverter.
|
||||
* Contains \Drupal\language\ProxyClass\LanguageConverter.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -394,9 +394,9 @@ class LanguageSwitchingTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test language switcher links for session based negotiation.
|
||||
* Tests language switcher links for session based negotiation.
|
||||
*/
|
||||
function testLanguageSessionSwitchLinks() {
|
||||
public function testLanguageSessionSwitchLinks() {
|
||||
// Add language.
|
||||
$edit = array(
|
||||
'predefined_langcode' => 'fr',
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\language\Tests\Migrate\MigrateLanguageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\language\Tests\Migrate;
|
||||
|
||||
use Drupal\language\ConfigurableLanguageInterface;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateLanguageTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['language'];
|
||||
|
||||
/**
|
||||
* Asserts various properties of a configurable language entity.
|
||||
*
|
||||
* @param string $id
|
||||
* The language ID.
|
||||
* @param string $label
|
||||
* The language name.
|
||||
* @param string $direction
|
||||
* (optional) The language's direction (one of the DIRECTION_* constants in
|
||||
* ConfigurableLanguageInterface). Defaults to LTR.
|
||||
* @param int $weight
|
||||
* (optional) The weight of the language. Defaults to 0.
|
||||
*/
|
||||
protected function assertLanguage($id, $label, $direction = ConfigurableLanguageInterface::DIRECTION_LTR, $weight = 0) {
|
||||
/** @var \Drupal\language\ConfigurableLanguageInterface $language */
|
||||
$language = ConfigurableLanguage::load($id);
|
||||
$this->assertTrue($language instanceof ConfigurableLanguageInterface);
|
||||
$this->assertIdentical($label, $language->label());
|
||||
$this->assertIdentical($direction, $language->getDirection());
|
||||
$this->assertIdentical(0, $language->getWeight());
|
||||
$this->assertFalse($language->isLocked());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of Drupal 6 languages to configurable language entities.
|
||||
*/
|
||||
public function testLanguageMigration() {
|
||||
$this->executeMigration('language');
|
||||
$this->assertLanguage('en', 'English');
|
||||
$this->assertLanguage('fr', 'French');
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ abstract class LanguageTestBase extends ViewKernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function schemaDefinition() {
|
||||
$schema = parent::schemaDefinition();
|
||||
|
@ -46,7 +46,7 @@ abstract class LanguageTestBase extends ViewKernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function viewsData() {
|
||||
$data = parent::viewsData();
|
||||
|
@ -68,7 +68,7 @@ abstract class LanguageTestBase extends ViewKernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views\Tests\ViewTestBase::dataSet().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dataSet() {
|
||||
$data = parent::dataSet();
|
||||
|
|
Reference in a new issue