Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes
This commit is contained in:
parent
1a0e9d9fac
commit
a6b049dd05
538 changed files with 5247 additions and 1594 deletions
|
@ -83,7 +83,9 @@ function path_entity_base_field_info(EntityTypeInterface $entity_type) {
|
|||
* Implements hook_entity_translation_delete().
|
||||
*/
|
||||
function path_entity_translation_delete(EntityInterface $translation) {
|
||||
$path = $translation->urlInfo()->getInternalPath();
|
||||
$conditions = array('source' => '/' . $path, 'langcode' => $translation->language()->getId());
|
||||
\Drupal::service('path.alias_storage')->delete($conditions);
|
||||
if ($translation->hasLinkTemplate('canonical')) {
|
||||
$path = $translation->urlInfo()->getInternalPath();
|
||||
$conditions = array('source' => '/' . $path, 'langcode' => $translation->language()->getId());
|
||||
\Drupal::service('path.alias_storage')->delete($conditions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\path\tests\Kernel\PathNoCanonicalLinkTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\path\Kernel;
|
||||
|
||||
use Drupal\content_translation_test\Entity\EntityTestTranslatableUISkip;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
|
||||
/**
|
||||
* Tests path alias deletion when there is no canonical link template.
|
||||
*
|
||||
* @group path
|
||||
*/
|
||||
class PathNoCanonicalLinkTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('path', 'content_translation_test', 'language', 'entity_test', 'user', 'system');
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('entity_test');
|
||||
$this->installEntitySchema('entity_test_mul');
|
||||
$this->installSchema('system', 'router');
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
|
||||
// Adding german language.
|
||||
ConfigurableLanguage::create(['id' => 'de'])->save();
|
||||
|
||||
$this->config('language.types')->setData([
|
||||
'configurable' => ['language_interface'],
|
||||
'negotiation' => ['language_interface' => ['enabled' => ['language-url' => 0]]],
|
||||
])->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for no canonical link templates.
|
||||
*/
|
||||
public function testNoCanonicalLinkTemplate() {
|
||||
$entity_type = EntityTestTranslatableUISkip::create([
|
||||
'name' => 'name english',
|
||||
'language' => 'en'
|
||||
]);
|
||||
$entity_type->save();
|
||||
|
||||
$entity_type->addTranslation('de', ['name' => 'name german']);
|
||||
$entity_type->save();
|
||||
$this->assertEqual(count($entity_type->getTranslationLanguages()), 2);
|
||||
|
||||
$entity_type->removeTranslation('de');
|
||||
$entity_type->save();
|
||||
$this->assertEqual(count($entity_type->getTranslationLanguages()), 1);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue